iconmaster

quarry-server

Apr 27th, 2013
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. NO_TURTLES = 3
  2.  
  3. while true do
  4. redstone.setOutput("right",true)
  5. sleep(.5)
  6. redstone.setOutput("right",false)
  7.  
  8. print("Sending out magenta...")
  9. redstone.setBundledOutput("left",colors.magenta)
  10. sleep(5)
  11. redstone.setBundledOutput("left",0)
  12.  
  13. n = 0
  14.  
  15. repeat
  16. print("waiting for turtle" .. (n+1))
  17. repeat
  18. sleep(math.random()*2)
  19. until colors.test(redstone.getBundledInput("left"),colors.white)
  20. n = n + 1
  21. print("turtle " .. n .. "found!")
  22. redstone.setBundledOutput("left",colors.orange)
  23. sleep(2)
  24. redstone.setBundledOutput("left",0)
  25. until n == NO_TURTLES
  26. sleep(1)
  27. print("All turtles home!")
  28.  
  29. redstone.setOutput("front",true)
  30. sleep(.5)
  31. redstone.setOutput("front",false)
  32. sleep(1)
  33. end
Advertisement
Add Comment
Please, Sign In to add comment