Advertisement
Guest User

startup

a guest
Apr 6th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.93 KB | None | 0 0
  1. rednet.open('left')
  2. print("pinging")
  3. repeat
  4. local id, command = rednet.receive()
  5. if command == "ping" then
  6. rednet.send(id,"ping")
  7. end
  8. until command == "ping"
  9. print("Syncing.")
  10. repeat
  11. local id, command = rednet.receive(3)
  12. until command == "sync"
  13. id, fromId = rednet.receive()
  14. fromId = tonumber(fromId)
  15. rednet.send(fromId,os.getComputerID())
  16. print("Nothing to display xD")
  17. rednet.open('left')
  18. while true do
  19. local id, command = rednet.receive()
  20. if command == "ping" then
  21. sleep(1)
  22. rednet.send(id,"ping")
  23. else
  24. if id == fromId then
  25. if command == "forward" then
  26. turtle.forward()
  27. end
  28. if command == "back" then
  29. turtle.back()
  30. end
  31. if command == "left" then
  32. turtle.turnLeft()
  33. end
  34. if command == "right" then
  35. turtle.turnRight()
  36. end
  37. if command == "up" then
  38. turtle.up()
  39. end
  40. if command == "down" then
  41. turtle.down()
  42. end
  43. if command == "dig" then
  44. turtle.dig()
  45. end
  46. if command == "place" then
  47. turtle.place()
  48. end
  49. end
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement