Jeyjey0

Stripmine3

Nov 12th, 2016
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.73 KB | None | 0 0
  1. os.unloadAPI("mine")
  2. os.unloadAPI("mine2")
  3. os.unloadAPI("mine3")
  4. os.unloadAPI("mine4")
  5. os.unloadAPI("torch")
  6. os.unloadAPI("detect")
  7. os.loadAPI("mine")
  8. os.loadAPI("mine2")
  9. os.loadAPI("mine3")
  10. os.loadAPI("mine4")
  11. os.loadAPI("torch")
  12. os.loadAPI("detect")
  13. term.clear()
  14. term.setCursorPos(1, 1)
  15. local usde = 0
  16. print("want you use the detector? pls enter :")
  17. print("1. YES")
  18. print("2. NO")
  19. print()
  20. input5 = read()
  21. if input5 == "1" == true then
  22. detect.start()
  23. usde = 1
  24. else
  25. end
  26. score = 0
  27. fuel = turtle.getFuelLevel()
  28. term.clear()
  29. turtle.turnLeft()
  30. distance = 0
  31. local check = 0
  32. turtle.turnLeft()
  33. if turtle.detect() == true then
  34. chest = 1
  35. else
  36. chest = 2
  37. end
  38. h = fs.open("/stripmineprogramm/number","w")
  39. h.write(distance)
  40. h.close()
  41. mined = 0
  42. turtle.turnLeft()
  43. turtle.turnLeft()
  44. local tArgs = {...}
  45. if #tArgs < 2 == true or #tArgs > 2 == true then
  46. local er2 = 0
  47. print(" ERROR: Stripmine <Number> <number>")
  48. error()
  49. end
  50. input1 = tonumber(tArgs[1])
  51. input2 = tonumber(tArgs[2])
  52. if tonumber(input1) ~= nil or tonumber(input2) ~= nil then
  53. else
  54. print("ERROR: stripmine <Length> <InSide>")
  55. error()
  56. end
  57. print("Calculate fuel ...")
  58. fuel = turtle.getFuelLevel()
  59. cal1 = ( input1*3 + input2 + input2 * 0.5 ) * 2
  60. block = input1 *3 * 2 + (input2 + input2) * 2 * input1
  61. print("Fuel needed :",cal1)
  62. print("Your FUEL: ",fuel)
  63. sleep(1.25)
  64. mineblock = 0
  65. if chest == 1 == true then
  66. term.clear()
  67. term.setCursorPos(1, 1)
  68. print("CHEST: ON")
  69. end
  70. if chest == 2 == true then
  71. term.clear()
  72. term.setCursorPos(1, 1)
  73. print("CHEST: OFF")
  74. end
  75. sleep(0.75)
  76. term.clear()
  77. term.setCursorPos(1, 1)
  78. fucoun = turtle.getFuelLevel()
  79. print("Fuel: ",fucoun)
  80. print("Mining Blocks: ",block)
  81. print("Mined Blocks: ",score)
  82. for i=1,input1 do
  83. mine2.mine()
  84. if usde == 1 == true then
  85. detect.detectLeft()
  86. detect.detectRight()
  87. turtle.up()
  88. detect.detectLeft()
  89. detect.detectRight()
  90. turtle.down()
  91. end
  92.  
  93. mine.bridge()
  94. score = score +1
  95. score = score+1
  96. term.clear()
  97. term.setCursorPos(1, 1)
  98. fucoun = turtle.getFuelLevel()
  99. print("Fuel: ",fucoun)
  100. print("Mining Blocks: ",block)
  101. print("Mined Blocks: ",score)
  102. mineblock = mineblock + 1
  103. mine2.mine()
  104. if usde == 1 == true then
  105. detect.detectLeft()
  106. detect.detectRight()
  107. turtle.up()
  108. detect.detectLeft()
  109. detect.detectRight()
  110. turtle.down()
  111. end
  112. mine.bridge()
  113. score = score +1
  114. score = score+1
  115. term.clear()
  116. term.setCursorPos(1, 1)
  117. fucoun = turtle.getFuelLevel()
  118. print("Fuel: ",fucoun)
  119. print("Mining Blocks: ",block)
  120. print("Mined Blocks: ",score)
  121. mineblock = mineblock + 1
  122. mine2.mine()
  123. if usde == 1 == true then
  124. detect.detectLeft()
  125. detect.detectRight()
  126. turtle.up()
  127. detect.detectLeft()
  128. detect.detectRight()
  129. turtle.down()
  130. end
  131. mine.bridge()
  132. score = score +1
  133. score = score+1
  134. term.clear()
  135. term.setCursorPos(1, 1)
  136. fucoun = turtle.getFuelLevel()
  137. print("Fuel: ",fucoun)
  138. print("Mining Blocks: ",block)
  139. print("Mined Blocks: ",score)
  140. mineblock = mineblock + 1
  141. if mineblock > 4 == true then
  142. torch.torch()
  143. mineblock = 0
  144. end
  145. turtle.turnLeft()
  146. for i=1,input2 do
  147. mine2.mine()
  148. if usde == 1 == true then
  149. detect.detectLeft()
  150. detect.detectRight()
  151. turtle.up()
  152. detect.detectLeft()
  153. detect.detectRight()
  154. turtle.down()
  155. end
  156. mine.bridge()
  157. score = score +1
  158. score = score+1
  159. term.clear()
  160. term.setCursorPos(1, 1)
  161. fucoun = turtle.getFuelLevel()
  162. print("Fuel: ",fucoun)
  163. print("Mining Blocks: ",block)
  164. print("Mined Blocks: ",score)
  165. end
  166. turtle.turnLeft()
  167. turtle.turnLeft()
  168. for i =1,input2 do
  169. mine2.mine()
  170. end
  171. for i=1,input2 do
  172. mine2.mine()
  173. if usde == 1 == true then
  174. detect.detectLeft()
  175. detect.detectRight()
  176. turtle.up()
  177. detect.detectLeft()
  178. detect.detectRight()
  179. turtle.down()
  180. end
  181. mine.bridge()
  182. score = score +1
  183. score = score+1
  184. term.clear()
  185. term.setCursorPos(1, 1)
  186. fucoun = turtle.getFuelLevel()
  187. print("Fuel: ",fucoun)
  188. print("Mining Blocks: ",block)
  189. print("Mined Blocks: ",score)
  190. end
  191. turtle.turnLeft()
  192. turtle.turnLeft()
  193. for i =1,input2 do
  194. mine2.mine()
  195. if usde == 1 == true then
  196. detect.detectLeft()
  197. detect.detectRight()
  198. turtle.up()
  199. detect.detectLeft()
  200. detect.detectRight()
  201. turtle.down()
  202. end
  203. end
  204. distance = distance + 1
  205. h = fs.open("/stripmineprogramm/number","w")
  206. h.write(distance)
  207. h.close()
  208. turtle.turnRight()
  209. drop2 = 0
  210. for i =1,16 do
  211. drop2 = drop2 + 1
  212. turtle.select(drop2)
  213. count3 = turtle.getItemCount()
  214. if count3 >= 1 == true then
  215. item = turtle.getItemDetail()
  216. if item.name == "minecraft:torch" == false then
  217. item2 = turtle.getItemCount()
  218. mined = mined + item2
  219. end
  220. end
  221. end
  222. if chest == 1 == true then
  223. mine3.check()
  224. mine4.refuel()
  225. end
  226. end
  227. if chest == 1 == true then
  228. turtle.turnLeft()
  229. turtle.turnLeft()
  230. turtle.up()
  231. te = input1*3
  232. for i = 1,te do
  233. mine2.mine2()
  234. end
  235. turtle.down()
  236. mine.clear()
  237. end
  238. term.clear()
  239. term.setCursorPos(1,1)
  240. print("Finish")
  241. print("Items Mined: ",score)
Add Comment
Please, Sign In to add comment