Advertisement
Guest User

Untitled

a guest
Jul 17th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 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. turtle.dig()
  87. forward()
  88. turnRight()
  89. up()
  90. repeat
  91.  
  92. local j = 2
  93. repeat
  94.  
  95. local k = 1
  96. repeat
  97. turtle.digUp()
  98. turtle.digDown()
  99. turtle.dig()
  100. forward()
  101. k = k + 1
  102.  
  103. until k >= width
  104. turtle.digDown()
  105. checkFull()
  106. turnRight()
  107. turnRight()
  108. up()
  109. up()
  110. up()
  111. j = j + 3
  112. local k = 1
  113. repeat
  114. turtle.digUp()
  115. turtle.digDown()
  116. turtle.dig()
  117. forward()
  118. k = k + 1
  119.  
  120. until k >= width
  121. turtle.digDown()
  122. checkFull()
  123. turnRight()
  124. turnRight()
  125.  
  126. if(j>= height-1) then
  127.  
  128. else
  129. up()
  130. up()
  131. up()
  132. j = j + 3
  133. end
  134.  
  135. until j >= height - 1
  136.  
  137. repeat
  138. down()
  139. down()
  140. down()
  141. j = j - 1
  142. until j <= 2
  143. turnLeft()
  144. i = i + 1
  145. until i > length
  146.  
  147. down()
  148. turnLeft()
  149. turnLeft()
  150. repeat
  151. forward()
  152. i = i - 1
  153. until i <= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement