condecero

PhyscoKillerMonkey Turtle 03

Dec 11th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. rednet.open("right") --Open rednet, make clearing the screen a single function
  2. function clear() term.clear() term.setCursorPos(1, 1) end
  3. while true do
  4. clear()
  5. print("Connected, ID: ", os.computerID(), ". Listening for turtles")
  6. id, msg = rednet.receive() --Wait for a turtle to say it is "Listening"
  7. if msg == "Listening" then
  8. rednet.send(id, "goto") --When a waiting turtle is found send the command (goto) to its ID so it can ready for the transmision of coordinates
  9. clear()
  10. print("Turtle found, enter goto coordinates")
  11. print("Enter X")
  12. local gox = tonumber(io.read()) --Get the coordinates from the player, they could be aquired by another means if needed
  13. clear()
  14. print("Enter Y")
  15. local goy = tonumber(io.read())
  16. clear()
  17. print("Enter Z")
  18. local goz = tonumber(io.read())
  19. clear()
  20. print("Coordinates are: ")
  21. print("X: ",x)
  22. print("Y: ",y)
  23. print("Z: ",z)
  24. print("Sending coordinates")
  25. rednet.send(id, tostring(gox)) --Convert the coordinates to strings (as rednet only sends strings) and send them to the waiting turtle
  26. sleep(0.5)
  27. rednet.send(id, tostring(goy))
  28. sleep(0.5)
  29. rednet.send(id, tostring(goz))
  30. end
  31. end
Add Comment
Please, Sign In to add comment