11 posts
Location
United States of America
Posted 27 January 2016 - 06:12 PM
I apologize in advance if these questions have been answered but.
Is there a way to partition?
What I mean is there are many types of OS's out there for CC, but if you would like to have multiple on a disk, how could you do that? I haven't really played with CC but I have been using OpenComputers (OC for short). In OC you would have to trick the API into thinking that there are more than one HDD (or something like that). I was wondering if there was a way to do that with CC (partitioning not tricking the API). This leads into the second question
Is there a specific way to download multiple things from a script?
What I mean is, in a script is there a specific way I need to set it up? In OC it would be something like this:
os.execute("pastebin get 53C53")
os.execute("pastebin get 63C24")
etc…
Again I apologize if these questions have already been answered, and I thank you for helping me out.
95 posts
Location
A CPU some where in Bolton, UK
Posted 27 January 2016 - 08:09 PM
Not so much a partition, more of a file system.
If you are wanting to store them on a disk then you could have each OS in its own Directory (file)
mkdir "dirName"
using this when on the terminal (not in a program) will make a directory, you can copy the OSs into the file.
Now if the OS has mulitple files then this is a problem, im not fully sure how you could do (without messing around with the program its self) it but one way would be making a startup program which asks you which OS you want to launch and then once you have selected it the one you want, the computer would copy the OS from the disk on to the computer.
I mean there proberly is better ways of doing this but thats just of the top of my head.
Edited on 27 January 2016 - 07:11 PM
3057 posts
Location
United States of America
Posted 27 January 2016 - 09:47 PM
I think you're looking for shell.run. However, using http.get directly is better, if a little harder.
1852 posts
Location
Sweden
Posted 27 January 2016 - 10:58 PM
If you want, you could use my pastebin API, which basically allows you to download/upload.
http://pastebin.com/hbHHH9UXYou can ofcourse tweak it in any way you want, and the usage for it is pretty self-explainatory, where the put function uploads and the get function downloads.
So for example you could do this
local files = {
["somefile"] = "code";
["someotherfile"] = "someotherpastebincode";
}
--# Download all files in the table above
for k, v in pairs( files ) do
pastebin.get( k, v )
end
But as KingOfGamesYami said above you can also use shell.run, which isn't that hard to do either
local files = {
["somefile"] = "code";
["someotherfile"] = "someotherpastebincode";
}
for k, v in pairs( files ) do
shell.run( "pastebin get " .. v .. " " .. k )
end
this would act as running "pastebin get <code> <name>" in the shell.
2427 posts
Location
UK
Posted 27 January 2016 - 11:33 PM
A thing to note about using the pastebin program from within another program is that it will still print to the screen (unless you get clever with os.run).
This is seen as unprofessional if you publish the code, but for your own programs you probably don't care.
7083 posts
Location
Tasmania (AU)
Posted 28 January 2016 - 12:33 AM
(unless you get clever with os.run)
Not sure what you're thinking of, but off the top of my head one of the easiest ways to hide the output would be to define an invisible window, redirect to that, then shell.run() the pastebin script.
957 posts
Location
Web Development
Posted 28 January 2016 - 01:05 AM
(unless you get clever with os.run)
Not sure what you're thinking of, but off the top of my head one of the easiest ways to hide the output would be to define an invisible window, redirect to that, then shell.run() the pastebin script.
Although just to be clear, its much cleaner to use the HTTP api directly, rather than the pastebin program, since you can get the output yourself.
256 posts
Posted 28 January 2016 - 01:20 AM
Another thing to note is that if you plan to package an application you have made, hence the need for downloading multiple files, you may find it favourable to use a packager. A good example of this is
Package by BombBloke. An alternative to this is
Compress by Creator. These programs can package multiple files into an archive that can be extracted. Package creates a compressed archive that you can decompress and extract with your own installer file which you can distribute via Pastebin, whereas Compress makes a self-extracting archive. If you need them, you may choose one of these to your preference.
Also, to follow up on what Mr_Programmer said for your first question, there is no way to directly create a partition in ComputerCraft. I'm not sure if the following is possible, but you could create a custom filesystem within a top-level OS, which then allows you to create your own bootloader and choose a partition to boot from (run the startup file of). I believe there are a few operating systems released or being released that allow you to do something similar to this.
Alternatively, you could use floppy disks. Probably the easier solution.
Edited on 28 January 2016 - 12:23 AM