star_weaver

turtle

Jun 19th, 2013
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. --[[ Torches in Slot 16
  2. Enderchest to Storage System in 15
  3. Enderchest filled with Torches in 14
  4. If you don't want this to use torches
  5. you'll need to modify the script a little.
  6. I'll tell you how.
  7. Go to function torchtunnel() and find these:
  8. MoreTorches()
  9. turtle.select(16)
  10. turtle.placeDown()
  11. turtle.select(1)
  12. and then delete them, or simply do the
  13. two half square thingies followed by the
  14. two dashes like the ones this entire thing
  15. is written inside of and your turtle won't
  16. place any torches.f ]]--
  17.  
  18. local tArgs = {...}
  19. local length = tonumber(tArgs[1])
  20. local shaft = tonumber(tArgs[2])
  21.  
  22. turtle.select(1)
  23.  
  24. function Front()
  25. while turtle.detect() do
  26. turtle.dig()
  27. sleep(.5)
  28. end
  29. end
  30.  
  31. function Top()
  32. while turtle.detectUp() do
  33. turtle.digUp()
  34. sleep(1)
  35. end
  36. end
  37.  
  38. function Go()
  39. Front()
  40. turtle.forward()
  41. Top()
  42. Bottom()
  43. end
  44.  
  45. function Bottom()
  46. turtle.digDown()
  47. turtle.select(1)
  48. end
  49.  
  50. function Refuel()
  51. for n = 1,13 do
  52. turtle.select(n)
  53. turtle.refuel()
  54. end
  55. end
  56.  
  57. function CheckFuel()
  58. if turtle.getFuelLevel() < 100 then
  59. Refuel()
  60. NoFuel()
  61. end
  62. end
  63.  
  64. function NoFuel()
  65. while turtle.getFuelLevel() < 100 do
  66. print("I need fuel, put some in.")
  67. Refuel()
  68. sleep(10)
  69. end
  70. end
  71.  
  72. function torchtunnel()
  73. for b = 1,5 do
  74. Go()
  75. DropOff()
  76. end
  77. MoreTorches()
  78. turtle.select(16)
  79. turtle.placeDown()
  80. turtle.select(1)
  81. CheckFuel()
  82. end
  83.  
  84. function MoreTorches()
  85. if turtle.getItemCount(16) == 0 then
  86. turtle.select(14)
  87. turtle.turnLeft()
  88. turtle.turnLeft()
  89. turtle.place()
  90. turtle.select(16)
  91. TorchChest()
  92. turtle.select(14)
  93. turtle.dig()
  94. turtle.select(1)
  95. turtle.turnLeft()
  96. turtle.turnLeft()
  97. end
  98. end
  99.  
  100. function TorchChest()
  101. if turtle.suck() then
  102. print("Torches Received")
  103. else
  104. while turtle.suck() == false do
  105. print ("Chest is out of Torches!")
  106. sleep(10)
  107. end
  108. end
  109. end
  110.  
  111. function DropOff()
  112. if turtle.getItemCount(13) > 0 then
  113. print("full")
  114. turtle.turnLeft()
  115. turtle.turnLeft()
  116. turtle.select(15)
  117. turtle.place()
  118. for j = 1,13 do
  119. turtle.select(j)
  120. turtle.drop()
  121. end
  122. turtle.select(15)
  123. turtle.dig()
  124. turtle.select(1)
  125. turtle.turnLeft()
  126. turtle.turnLeft()
  127. end
  128. end
  129.  
  130. function Ready()
  131. for i = 1,length,1 do
  132. torchtunnel()
  133. end
  134. end
  135.  
  136. function Start()
  137. for h = 1,shaft,1 do
  138. Ready()
  139. local num = length*5
  140. for c = 1,num,1 do
  141. turtle.back()
  142. end
  143. turtle.turnLeft()
  144. Go()
  145. Go()
  146. Go()
  147. turtle.turnRight()
  148. end
  149. end
  150.  
  151. Start()
Add Comment
Please, Sign In to add comment