71 posts
Location
Nerdfightaria Island
Posted 09 February 2013 - 07:09 PM
Basically, I am making a land clearing program. However, after shutting off Minecraft, and starting it again, it stops the program. I have heard that you can edit a file from inside a program, so I have a vague idea of storing the variables in a program everytime they change, and be able to start where you left off from. I have no idea how to make some code like this, or even how it would really work. How would I do this, or is it even possible?
475 posts
Posted 09 February 2013 - 08:04 PM
You would need to save the state of the clearing in a file and when you log back into minecraft that file will be loaded to tell the turtle where it left off.
1243 posts
Location
Indiana, United States
Posted 10 February 2013 - 03:32 AM
Code would be
local file = fs.open("sampleFile", "w")
file.write("Your variables")
file.close()
local f = fs.open("sampleFile", "r")
local sCont = f.readAll()
f.close()
print(sCont)
818 posts
Posted 10 February 2013 - 03:16 PM
Though you should be aware, it might not save if you for example log out during a turtle movement or such, because then it might not have time to actually record the movement