Last active
August 1, 2016 18:20
-
-
Save mightystoosh/93ddf71702bf4c0e07e31981ba0bdd26 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while(true) do | |
if(fs.exists("turtlegist")) then | |
print("great, found gist") | |
else | |
shell.run("pastebin get RMkd2KhU turtlegist") | |
end | |
rednet.open("left") | |
id, message = rednet.receive() | |
print("message found") | |
if(message ~= nil) then | |
print("found message") | |
gist_command, turtle_label = message:match("([^,]+),([^,]+)") | |
if(turtle_label == os.getComputerLabel()) then | |
print("on correct turtle, will proceed") | |
if turtle.getFuelLevel() == 0 then | |
turtle.refuel() | |
end | |
program_name = "new_program" .. "_" .. turtle_label | |
if(fs.exists(program_name)) then | |
print("removing program " .. program_name ) | |
shell.run("rm " .. program_name) | |
end | |
print("downloading " .. gist_command .. " as program " .. program_name) | |
shell.run("turtlegist get " .. gist_command .. " " .. program_name ) | |
print("running " .. program_name) | |
shell.run(program_name) | |
print("completed running program") | |
else | |
print("turtle doesn't match " .. turtle_label) | |
end | |
end | |
os.sleep(1) | |
end | |
-- rednet.broadcast("d6a57481983b997a7035c5d828f6d6ee,stutest") | |
-- TODO add 2 more computers for GPS. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment