libraryaddict

Untitled

Apr 27th, 2012
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. --Master
  2. rednet.open("right")
  3. times = 0
  4. sleep(1)
  5. rednet.broadcast("Changeover")
  6. print("Changeover!")
  7. Hos = 0
  8. repeat
  9.   local ID, Msg = rednet.receive()
  10.   if Msg == "Changedover!" then
  11.     Hos = Hos+1
  12.     print("Changeover callbacks = "..Hos)
  13.   end
  14. until Hos == 8
  15. print("Changedover!")
  16. while true do
  17.   if turtle.forward() then
  18.     if times < 50 then
  19.       rednet.broadcast("Heave!")
  20.       times = times+1
  21.       Hos = 0
  22.       repeat
  23.         local ID, Msg = rednet.receive()
  24.         if Msg == "Ho!" then
  25.           Hos = Hos+1
  26.         end
  27.       until Hos == 8
  28.     else
  29.       rednet.broadcast("Changeover")
  30.       times = 0
  31.       Hos = 0
  32.       repeat
  33.         local ID, Msg = rednet.receive()
  34.         if Msg == "Changedover!" then
  35.           Hos = Hos+1
  36.         end
  37.       until Hos == 8
  38.       sleep(0.2)
  39.       rednet.broadcast("Heave!")
  40.             Hos = 0
  41.       repeat
  42.         local ID, Msg = rednet.receive()
  43.         if Msg == "Ho!" then
  44.           Hos = Hos+1
  45.         end
  46.       until Hos == 8
  47.     end
  48.   end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment