Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- rednet.open("left")
- features = {}
- features[1] = "remote update"
- features[2] = "remove moving"
- print("Turtle Program: v1.0")
- print("Contains:")
- for i=1, features do
- print(features[i]
- end
- print("waiting for rednet")
- id, command = rednet.receive()
- print(command)
- function init()
- if command == "rollcall" then
- rednet.send(6, "response")
- awaitInstruction()
- elseif command == "update" then
- fileUpdate()
- end
- end
- function awaitInstruction()
- id, message = rednet.receive()
- if id == 6 then
- if message == "move" then
- turtle.refuel()
- while true do
- parallel.waitForAny(fileUpdate, awaitInstruction)
- local see, block = turtle.inspect()
- if see == true then
- --turtle.forward()
- else
- turtle.turnLeft()
- turtle.turnLeft()
- end
- end
- end
- end
- end
- function fileUpdate()
- while true do
- if fs.exists("backup/oldStartup") then
- fs.delete("backup/oldStartup")
- end
- fs.copy("startup", "backup/oldStartup")
- fs.delete("startup")
- fid1, msg2 = rednet.receive()
- print(msg2)
- print(fid1)
- f = fs.open(msg2, "w")
- fid2, msg3 = rednet.receive()
- f.write(msg3)
- f.close()
- os.reboot()
- end
- end
- init()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement