Advertisement
MadScience2728

Master4

Jan 4th, 2014
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. -- Number of neighbouring turtles
  2. numberNeighbours = 2
  3.  
  4. -- Open up modem to receive wireless broadcasts
  5. rednet.open("right")
  6.  
  7. -- Wait until neighbouring turtles are ready
  8. function waitForNeighbours(localRowsProgressed)
  9. local remoteTurtleID, remoteRowsProgressed
  10.  
  11. -- Wait for all neighbours to have done same number of rows as master
  12. for i=1, numberNeighbours do
  13. repeat
  14. -- Find how many rows the current remote turtle has done
  15. remoteTurtleID, remoteRowsProgressed, _ = rednet.receive()
  16. remoteRowsProgressed = string.match( remoteRowsProgressed, "ROW<%d+>" )
  17. remoteRowsProgressed = string.match( remoteRowsProgressed, "%d+" )
  18. remoteRowsProgressed = tonumber( remoteRowsProgressed )
  19.  
  20. -- If this is a valid rednet message, and remote turtle is lagging behind, tell him to continue
  21. if (remoteRowsProgressed ~= nil) and (remoteRowsProgressed < localRowsProgressed) then
  22. rednet.send(remoteTurtleID, "You are authorised to proceed")
  23. end
  24.  
  25. until localRowsProgressed == remoteRowsProgressed
  26. end
  27.  
  28. rednet.broadcast("You are authorised to proceed")
  29. end
  30.  
  31. bool=true
  32.  
  33. while bool==true do
  34. if rs.getInput("back", true) then
  35. print ("Waiting")
  36. sleep (1)
  37. else
  38. print ("Let's Roll!")
  39. bool=false
  40. end
  41. end
  42.  
  43. X=3
  44.  
  45. print ("Startup Functions Activating")
  46. print ("Going to lowest point")
  47.  
  48. turtle.select(3)
  49. turtle.back()
  50.  
  51. for a = 1, X do
  52. turtle.digDown()
  53. turtle.attackDown()
  54. turtle.attackDown()
  55. turtle.attackDown()
  56. turtle.attackDown()
  57. turtle.attackDown()
  58. turtle.attackDown()
  59. turtle.attackDown()
  60. turtle.attackDown()
  61. turtle.attackDown()
  62. turtle.attackDown()
  63. turtle.attackDown()
  64. turtle.attackDown()
  65. turtle.attackDown()
  66. turtle.attackDown()
  67. turtle.attackDown()
  68. turtle.attackDown()
  69. turtle.attackDown()
  70. turtle.attackDown()
  71. turtle.attackDown()
  72. turtle.attackDown()
  73. turtle.down()
  74. end
  75.  
  76. for b = 1, X do
  77. turtle.digUp()
  78. while not turtle.up() do
  79. turtle.attackUp()
  80. end
  81. end
  82.  
  83. print ("Calibrated level for a flat bedrock world.")
  84. print ("---------------------------")
  85. print ("Starting World Eating Scripts!")
  86. print ("---------------------------")
  87.  
  88. turtle.dig()
  89.  
  90. while not turtle.forward() do
  91. turtle.attack()
  92. end
  93.  
  94. while true do
  95.  
  96. for i = 1, 2 do
  97.  
  98. for c = 1, X do
  99. turtle.dig()
  100. turtle.digDown()
  101. while not turtle.down() do
  102. turtle.attackDown()
  103. end
  104. end
  105.  
  106. for d = 1, X do
  107. turtle.dig()
  108. turtle.digUp()
  109. while not turtle.up() do
  110. turtle.attackUp()
  111. end
  112. end
  113.  
  114. for r = 1, 2 do
  115. turtle.dig()
  116. while not turtle.forward() do
  117. turtle.attack()
  118. end
  119.  
  120. end
  121.  
  122. Fuel = turtle.getFuelLevel()
  123.  
  124. print ("Fuel level is: "..Fuel)
  125.  
  126. if Fuel >= 8192 then
  127.  
  128. print ("Fuel level is above minimum safe limit.")
  129. print ("Refueling anyway")
  130.  
  131. turtle.select(1)
  132.  
  133. for slot = 3, 16 do
  134. result = turtle.compareTo(slot)
  135. if result == true then
  136. turtle.select(slot)
  137. turtle.refuel()
  138. turtle.select(1)
  139. print ("Refueled on slot "..slot)
  140. else
  141. end
  142. end
  143.  
  144. else
  145.  
  146. print ("Fuel is below safe limit! Not collecting enough coal!")
  147.  
  148. turtle.select(1)
  149.  
  150. for slot = 3, 16 do
  151. result = turtle.compareTo(slot)
  152. if result == true then
  153. turtle.select(slot)
  154. turtle.refuel()
  155. turtle.select(1)
  156. print ("Refueled on slot "..slot)
  157. else
  158. end
  159. end
  160. end
  161.  
  162. turtle.select(2)
  163. print ("Dropping off items")
  164.  
  165. turtle.dig()
  166.  
  167. while not turtle.place() do
  168. turtle.attack()
  169. end
  170.  
  171. for dropslot = 3, 16 do
  172. turtle.select(dropslot)
  173. turtle.drop()
  174. end
  175.  
  176. waitForNeighbours()
  177.  
  178. turtle.select(2)
  179.  
  180. turtle.dig()
  181.  
  182. turtle.select(3)
  183.  
  184. end
  185. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement