5 posts
Posted 18 December 2016 - 03:27 PM
Hi. I know, judging by the title, you would just want to delete this post. But here's the issue. The 'Read before Posting' topic is inconclusive about what I should do about my code, which, to my knowledge, has no commands requiring extra parenthesis, and no variables. I would really like help on this code. Thanks! :)/>
http://pastebin.com/8Sc9N6sy
7083 posts
Location
Tasmania (AU)
Posted 18 December 2016 - 11:22 PM
The "import" function is not available in ComputerCraft by default. Since it's not a keyword either, the Lua VM doesn't have a clue what to make of "import shell", and hence figures you probably wanted to stick an equals symbol in there somewhere.
Instead, "shell" is loaded by CraftOS itself when your computer boots. You don't need to try and load it yourself, it's there already.
You might find
this tutorial useful. Note that the "shell" table isn't loaded via
os.loadAPI(), as most other APIs are; it's generated by the instance of CraftOS you're running your scripts in.
8543 posts
Posted 19 December 2016 - 12:28 AM
You'll have similar issues with the very next line as well, "clear" isn't a function. Perhaps you meant term.clear()?
5 posts
Posted 19 December 2016 - 12:25 PM
Thank you all. There were a bunch more issues I found with my code, but a couple of google searches and the tutorial Bomb Bloke showed me helped me too. I can now fix all my other broken code :D/> Thanks again!
172 posts
Location
USA
Posted 21 December 2016 - 12:50 PM
You can try this
local codes = {
[1] = {
"70naqtgn",
"Reboot"
},
[2] = {
"pastebin code",
"file/to/save/as"
},
-- etc.
}
local files = {
"Reboot",
"Shutdown",
"Startup",
"Update",
"uoscmds"
}
print("The system is updating...")
print("Please don't turn off your computer until the process is finished.")
print("Stage 1 (Deleting old files)")
for k,v in pairs(files) do
fs.delete(v)
end
print("Stage 2 (Downloading files)")
for k,v in pairs(codes) do
shell.run("pastebin get "..v[1].." "..v[2])
end
print("Done!")
print("The system will now reboot in 1 second . . .")
os.sleep(1)
os.reboot()