Advertisement
M0n5t3r

Untitled

Mar 21st, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.34 KB | None | 0 0
  1. --startup
  2. term.write("Insert Length: ")
  3. Length = tonumber(read())
  4. print(" ")
  5.  
  6. term.write("Insert - times 3 - Width: ")
  7. Width = tonumber(read())
  8. print(" ")
  9.  
  10. local Length = Length
  11. local Width = Width
  12.  
  13. local goRight = 0
  14. local torchSlot = 1
  15. local chestSlot = 2
  16. local counter = 0
  17. local torchCounter = 0
  18. local secondCounter = 0
  19. local firstStartup = 0
  20.  
  21.  
  22. function torchesslotcheck()
  23. if turtle.getItemCount(torchslot) < 1 then
  24. print("put torches in slot 1!")
  25. repeat
  26. sleep (1.1)
  27.  
  28. until turtle.getItemCount(torchslot) > 1
  29. end
  30. if turtle.getItemCount(chestSlot) < 1 then
  31. print("put chestes in slot 2!")
  32. repeat
  33. sleep (1.1)
  34. until turtle.getItemCount(chestSlot) >= 1
  35. end
  36. end
  37.  
  38. function mineForward()
  39. turtle.select(1)
  40. print(counter)
  41. -- dig vooruit, dig boven, dig onder
  42. repeat
  43. turtle.dig()
  44. until not turtle.detect() == true
  45. repeat
  46. turtle.digUp()
  47. until turtle.up() == true
  48. turtle.down()
  49. turtle.digDown()
  50.  
  51. if firstStartup == 0 then
  52. turtle.select(2)
  53. turtle.placeDown()
  54. firstStartup = 1
  55. select(1)
  56. end
  57. -- ga naar links, dig, naar voren, dig up
  58. turtle.turnLeft()
  59. repeat
  60. turtle.dig()
  61. until not turtle.detect() == true
  62. turtle.forward()
  63. repeat
  64. turtle.digUp()
  65. until turtle.up() == true
  66. turtle.down()
  67. turtle.digDown()
  68.  
  69. -- ga naar rechts, vooren, dig up dig down
  70. turtle.turnRight()
  71. turtle.turnRight()
  72. turtle.forward()
  73. repeat
  74. turtle.dig()
  75. until not turtle.detect() == true
  76. turtle.forward()
  77. repeat
  78. turtle.digUp()
  79. until turtle.up() == true
  80. turtle.down()
  81. turtle.digDown()
  82.  
  83. -- ga weer terug naar midden positie
  84. turtle.turnLeft()
  85. turtle.turnLeft()
  86. turtle.forward()
  87. turtle.turnRight()
  88. turtle.forward()
  89. print(counter)
  90. repeat
  91. turtle.dig()
  92. until not turtle.detect() == true
  93. counter = counter + 1
  94. secondCounter = secondCounter + 1
  95. if Length > 8 then
  96. if secondCounter == 8 then
  97. turtle.turnLeft()
  98. turtle.turnLeft()
  99. turtle.forward()
  100. turtle.select(1)
  101. turtle.placeDown()
  102. torchCounter = torchCounter + 1
  103. secondCounter = 0
  104. turtle.turnLeft()
  105. turtle.turnLeft()
  106. turtle.forward()
  107. end
  108. end
  109. if Length < 8 then
  110. if secondCounter == Length then
  111. turtle.turnLeft()
  112. turtle.turnLeft()
  113. turtle.forward()
  114. turtle.select(1)
  115. turtle.placeDown()
  116. torchCounter = torchCounter + 1
  117. secondCounter = 0
  118. turtle.turnLeft()
  119. turtle.turnLeft()
  120. turtle.forward()
  121. end
  122. end
  123. checkSlots()
  124. endCheck()
  125. end
  126.  
  127. function checkSlots()
  128. turtle.getItemCount(16)
  129. if turtle.getItemCount(16) > 0 then
  130. print("gotte go clean my inventory!")
  131. turtle.turnLeft()
  132. turtle.turnLeft()
  133. for i=1,counter do
  134. turtle.forward()
  135. end
  136. if goRight == 0 then
  137. for q=3,16 do
  138. turtle.select(q)
  139. turtle.dropDown()
  140. end
  141. turtle.turnLeft()
  142. turtle.turnLeft()
  143. for i=1,counter do
  144. turtle.forward()
  145. end
  146. end
  147. if goRight > 0 then
  148. turtle.turnLeft()
  149. x = 0
  150. repeat
  151. turtle.forward()
  152. turtle.forward()
  153. turtle.forward()
  154. x = x + 1
  155. until x == goRight
  156.  
  157. for q=3,16 do
  158. turtle.select(q)
  159. turtle.dropDown()
  160. end
  161. x = 0
  162. repeat
  163. turtle.forward()
  164. turtle.forward()
  165. turtle.forward()
  166. x = x + 1
  167. until x == goRight
  168.  
  169. turtle.turnRight()
  170. for i=1,counter do
  171. turtle.forward()
  172. end
  173. end
  174. end
  175. end
  176.  
  177. function endCheck()
  178. turtle.getItemCount(1)
  179. if turtle.getItemCount(1) == 1 then
  180. turtle.placeDown()
  181. turtle.turnLeft()
  182. turtle.turnLeft()
  183. for i=1,counter do
  184. turtle.forward()
  185. end
  186. end
  187. end
  188.  
  189. function goBack()
  190. print("gotte go back!")
  191. turtle.turnLeft()
  192. turtle.turnLeft()
  193. for i=1,counter do
  194. turtle.forward()
  195. end
  196. for q=3,16 do
  197. turtle.select(q)
  198. turtle.dropDown()
  199. end
  200. turtle.turnRight()
  201. repeat
  202. turtle.dig()
  203. until not turtle.detect() == true
  204.  
  205. i = 0
  206. repeat
  207. turtle.forward()
  208. repeat
  209. turtle.dig()
  210. until not turtle.detect() == true
  211. turtle.forward()
  212. repeat
  213. turtle.digUp()
  214. until turtle.up() == true
  215. turtle.down()
  216. turtle.digDown()
  217. i = i + 1
  218. until i == 1
  219. turtle.turnRight()
  220.  
  221. end
  222.  
  223.  
  224.  
  225. print("Lets GO!")
  226. torchesslotcheck()
  227.  
  228. repeat
  229. repeat
  230. mineForward()
  231. until counter == Length
  232. goBack()
  233.  
  234. goRight = goRight + 1
  235. counter = 0
  236. until goRight == Width
  237.  
  238. print ("DONE?")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement