MadScience2728

SOF8

Jan 17th, 2014
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --[[
  2. Changes:
  3. Turtles no longer monitor how many rows they've gone forward (no more rowsProgressed file)
  4. Master turtle simply waits for (numberNeighbours) unique turtles to send messages saying
  5. they are ready and waiting. Slave turtles repeatedly send ready and waiting signals to prevent
  6. the sync problems we were having before.
  7. --]]
  8.  
  9. -- Open up modem to receive wireless broadcasts
  10. rednet.open("right")
  11.  
  12. -- Wait until neighbouring turtles are ready
  13. function waitForMaster()
  14.   local event, param1, param2
  15.  
  16.   rednet.broadcast("I am ready and waiting master")
  17.   os.startTimer(1)
  18.  
  19.   while true do
  20.     event, param1, param2 = os.pullEvent()
  21.  
  22.     -- Resend ready message every second, in case master is not yet ready
  23.     if event == "timer" then
  24.       rednet.broadcast("I am ready and waiting master")
  25.       os.startTimer(1)
  26.    
  27.     -- Wait for master turtle to give the OK to proceed before continuing digging
  28.     elseif event == "rednet_message" then
  29.       local message = param2
  30.       if message == "You are authorised to proceed" then
  31.         break
  32.       end -- if message
  33.     end -- if event
  34.   end -- while
  35. end -- function
  36.  
  37. bool=true
  38.  
  39. while bool==true do
  40.   if rs.getInput("back", true) then
  41.       print ("Waiting")
  42.       sleep (1)
  43.   else
  44.     print ("Let's Roll!")
  45.     bool=false
  46.   end
  47. end
  48.  
  49. X=66
  50.  
  51.  
  52.  
  53.   print ("---------------------------")
  54.   print ("Starting World Eating Scripts!")
  55.   print ("---------------------------")
  56.  
  57.  
  58.  
  59.   while true do
  60.  
  61.  
  62. moves = 0
  63.  
  64. ore = false
  65.  
  66. turtle.select(2)
  67. ore = turtle.compareDown()
  68. turtle.select(3)
  69.  
  70. while ore == false and moves < 67 do
  71.         turtle.digDown()
  72.         moves = moves + 1
  73.         while not turtle.down() do
  74.                 turtle.attack()
  75.         end
  76.     sleep(.5)
  77.         turtle.select(2)
  78.         ore = turtle.compareDown()
  79.         turtle.select(3)
  80. end
  81.  
  82. for q=1, moves do
  83.         turtle.digUp()
  84.         while not turtle.up() do
  85.                 turtle.attack()
  86.                 turtle.digUp()
  87.         end
  88. end
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.       for r = 1, 2 do
  96.         turtle.dig()
  97.         while not turtle.forward() do
  98.           turtle.attack()
  99.         end
  100.  
  101.       end
  102.  
  103.     print ("Dropping off items")
  104.  
  105.         turtle.dig()
  106.         turtle.attack()
  107.      
  108.  
  109.     turtle.select(1)
  110.     while not turtle.place() do
  111.       turtle.select(3)
  112.       turtle.attack()
  113.       turtle.select(1)
  114.     end
  115.  
  116.     for dropslot = 3, 16 do
  117.       turtle.select(dropslot)
  118.       turtle.drop()
  119.     end
  120.  
  121.     waitForMaster()
  122.  
  123.     turtle.select(1)
  124.  
  125.     turtle.dig()
  126.  
  127.     turtle.select(3)
  128.  
  129.   end
Advertisement
Add Comment
Please, Sign In to add comment