MudkipTheEpic

GPS Summoner Turtle

Dec 26th, 2012
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. rednet.open("right")
  2. senderId, message, distance = rednet.receive(3)
  3. if distance == nil then
  4. print("Could not locate")
  5. sleep(2)
  6. os.shutdown()
  7. end
  8. olddistance = distance
  9. turtle.forward()
  10. senderId, message, distance = rednet.receive(3)
  11. if olddistance > distance then
  12. while true do
  13. olddistance = distance
  14. turtle.forward()
  15. distance = rednet.receive(3)
  16. if distance > olddistance then
  17. break
  18. end
  19. end
  20. elseif distance > olddistance then
  21. distance = olddistance
  22. turtle.turnLeft()
  23. turtle.turnLeft()
  24. turtle.forward()
  25. senderId, message, distance = rednet.receive(3)
  26. if distance > olddistance then
  27. print("ERROR!")
  28. sleep(2)
  29. os.shutdown()
  30. end
  31.  
  32. while true do
  33. olddistance = distance
  34. turtle.forward()
  35. senderId, message, distance = rednet.receive(3)
  36. if distance > olddistance then
  37. break
  38. end
  39. end
  40. end
  41. print("Aligned. Hopefully.....")
Advertisement
Add Comment
Please, Sign In to add comment