Advertisement
johncava

Untitled

Jul 17th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.14 KB | None | 0 0
  1.  
  2. chestSlot = 1;
  3. posX = 0
  4. posY = 0
  5. posZ = 0
  6. orientation = 0
  7.  
  8. function forward()
  9. repeat
  10. turtle.dig()
  11. until turtle.forward()
  12. end
  13.  
  14. function up()
  15. repeat
  16. turtle.digUp()
  17. until turtle.up()
  18. posZ = posZ + 1
  19. end
  20.  
  21. function down()
  22. repeat
  23. turtle.digDown()
  24. until turtle.down()
  25. posZ = posZ - 1
  26. end
  27.  
  28. function turnRight()
  29. turtle.turnRight()
  30. end
  31.  
  32. function turnLeft()
  33. turtle.turnLeft()
  34. end
  35.  
  36. function deposit()
  37.  
  38. turnRight()
  39. turnRight()
  40.  
  41. repeat
  42. turtle.dig()
  43. turtle.select(chestSlot)
  44. until turtle.place()
  45.  
  46. for i=1,16 do
  47. if(i~=chestSlot)then
  48. turtle.select(i)
  49. turtle.drop()
  50. end
  51. end
  52.  
  53. turtle.select(chestSlot)
  54. turtle.dig()
  55. turnRight()
  56. turnRight()
  57. turtle.select(2)
  58. end
  59.  
  60. function checkFull()
  61. local currentSlot = turtle.getSelectedSlot()
  62. turtle.select(13)
  63. if (turtle.getItemCount()>0) then
  64. deposit()
  65. else
  66. turtle.select(currentSlot)
  67. end
  68. end
  69.  
  70. function dig()
  71. turtle.dig()
  72. end
  73.  
  74. print "Enter Length"
  75. length = tonumber(read())
  76. print "Enter Width"
  77. width = tonumber(read())
  78. print "Enter height (multiple of 6)"
  79. height = tonumber(read())
  80. print "Please place ender chest in slot 1. Press any key to start."
  81. os.pullEvent("key")
  82.  
  83.  
  84.  
  85. local i = 1
  86.  
  87. up()
  88. repeat
  89.  
  90. turtle.dig()
  91. forward()
  92. turnRight()
  93. local j = 2
  94. repeat
  95.  
  96. local k = 1
  97. repeat
  98. turtle.digUp()
  99. turtle.digDown()
  100. turtle.dig()
  101. forward()
  102. k = k + 1
  103.  
  104. until k >= width
  105. turtle.digDown()
  106. checkFull()
  107. turnRight()
  108. turnRight()
  109. up()
  110. up()
  111. up()
  112. j = j + 3
  113. local k = 1
  114. repeat
  115. turtle.digUp()
  116. turtle.digDown()
  117. turtle.dig()
  118. forward()
  119. k = k + 1
  120.  
  121. until k >= width
  122. turtle.digDown()
  123. checkFull()
  124. turnRight()
  125. turnRight()
  126.  
  127. if(j>= height-1) then
  128. turtle.digUp()
  129. else
  130. up()
  131. up()
  132. up()
  133. j = j + 3
  134. end
  135.  
  136. until j >= height - 1
  137.  
  138. repeat
  139. down()
  140. down()
  141. down()
  142. j = j - 3
  143. until j <= 2
  144. turnLeft()
  145. i = i + 1
  146. until i > length
  147.  
  148. down()
  149. turnLeft()
  150. turnLeft()
  151. repeat
  152. forward()
  153. i = i - 1
  154. until i <= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement