Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Open rednet, make clearing the screen a single function
- rednet.open("right")
- function clear() term.clear() term.setCursorPos(1, 1) end
- while true do
- clear()
- print("Polaczono, ID: ", os.computerID(), ". Czekam na klienta.")
- print("Upewnij sie, ze turtle ma zainstalowany program 'goto'")
- rednet.broadcast("Listening") --Tell all other computers in the area that this turtle is ready and waiting for orders
- local id, msg = rednet.receive(10) --Wait for a return message for 10 seconds, then repeat
- if msg == "goto" then --If the incoming message is a goto request then prepare for coordinates (other commands can be added in this if statement in the future
- print("Znaleziono klienta ", id, ", czekam na koordynaty.")
- local id, msg = rednet.receive()
- gox = tonumber(msg) --Because only strings can be send over rednet the coordinates are changed to and from strings on each side of the message
- local id, msg = rednet.receive()
- goy = tonumber(msg)
- local id, msg = rednet.receive()
- goz = tonumber(msg)
- print("Koordynaty otrzymane, ide do ", gox, " ", goy, " ", goz)
- shell.run("goto", gox, goy, goz) --Run the goto program with the recived coordinates
- end
- end
Add Comment
Please, Sign In to add comment