This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
The_Awe35's profile picture

Continuing a program after leaving minecraft

Started by The_Awe35, 09 February 2013 - 06:09 PM
The_Awe35 #1
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?
lieudusty #2
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.
Tiin57 #3
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)
Doyle3694 #4
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