Posted 04 August 2013 - 10:43 PM
Today while working on a few programs, I had an idea that would make my programs more efficient. I need to some how make it to where my code saves variables from the program itself. Take for example, my harvesting program. When a player leaves the chunk, the program restarts because no one is in that chunk. I would have many uses from this but do not know where to start. It would need to save variables for like minutes, seconds, etc. I do not now where I would put this code, or where to even begin making it. Can someone help me out?
Here is my harvesting program for a reference:
Here is my harvesting program for a reference:
local wait_time = 30*60
local time_remaining = 0
term.clear()
term.setCursorPos(1,1)
term.setTextColor(colors.green)
while true do
term.clear()
term.setCursorPos(1,1)
time_remaining = wait_time
opt = rs.setO
print("RUNNING NS TECH CODE - EDITING PROHIBITED")
print("NS Tech AutoHarvest v1.0")
print("---------------------------------------------------")
while not sleep(1) and time_remaining > 0 do
term.setCursorPos(1,4)
term.clearLine()
local minutes = math.floor(time_remaining/60)
local seconds = math.floor(time_remaining%60)
print("Next harvest in " .. minutes .. " minutes and " .. seconds .. " seconds.")
time_remaining = time_remaining - 1
end
while true do
rs.setOutput("bottom", true)
sleep(8)
rs.setOutput("bottom", false)
os.reboot()
end
end