Advertisement
Guest User

TN

a guest
Jul 24th, 2014
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.95 KB | None | 0 0
  1. ##-- My turtle Program Made by Callum
  2. -- Current block
  3. print("This is Callum's 3x3 Tunnel Building Program")
  4. print("The turtle will Mine a 3x3 tunnel starting at the block IN FRONT of the currrent position of the turtle")
  5. print("ALWAYS but a chest directly behind where the turtle originally started for the materials to go into, otherwise the turtle will throw the items on the floor and despawn")
  6. local x
  7. -- How far to go
  8. local y
  9. -- Torches
  10. local t
  11. local f
  12. local p
  13. local v
  14. print("How far do you want me to mine?")
  15. x = 0
  16. y = tonumber(read())
  17. t = 7
  18. f = turtle.getFuelLevel()
  19. print("Do you want me to place torches? (Yes or No)")
  20. v = (read())
  21. p = y * 9 + y + y
  22. if f < p then
  23.   print("This turtle does not have the necessary fuel to do the tunnel size you have selected.")
  24.   print("the longest tunnel you can do is")
  25.   print(f / 11)
  26. end
  27. while x < y do
  28.   while turtle.detect() do
  29.     turtle.dig()
  30.   end
  31.   turtle.forward()
  32.   turtle.turnRight()
  33.   while turtle.detect() do
  34.     turtle.dig()
  35.   end
  36.   turtle.turnLeft()
  37.   turtle.turnLeft()
  38.   while turtle.detect() do
  39.     turtle.dig()
  40.   end
  41.   while turtle.detectUp() do
  42.     turtle.digUp()
  43.     sleep(0.4)
  44.   end
  45.   turtle.up()
  46.   while turtle.detect() do
  47.     turtle.dig()
  48.   end
  49.   turtle.turnRight()
  50.   turtle.turnRight()
  51.   while turtle.detect() do
  52.     turtle.dig()
  53.   end
  54.   while turtle.detectUp() do
  55.     turtle.digUp()
  56.     sleep(0.4)
  57.   end
  58.   turtle.up()
  59.   while turtle.detect() do
  60.     turtle.dig()
  61.   end
  62.   turtle.turnLeft()
  63.   turtle.turnLeft()
  64.   while turtle.detect() do
  65.     turtle.dig()
  66.   end
  67.   turtle.turnRight()
  68.   while turtle.detectDown() do
  69.     turtle.digDown()
  70.   end
  71.   turtle.down()
  72.   while turtle.detectDown() do
  73.     turtle.digDown()
  74.   end
  75.   turtle.down()
  76.   turtle.turnRight()
  77.   while turtle.detect() do
  78.     turtle.dig()
  79.   end
  80.   turtle.turnLeft()
  81.   turtle.turnLeft()
  82.   while turtle.detect() do
  83.     turtle.dig()
  84.   end
  85.   turtle.turnRight()
  86.  
  87.   x = x + 1
  88.   t = t + 1
  89.   if v == ("Yes") then
  90.     if t==8 then
  91.       turtle.turnLeft()
  92.       turtle.place()
  93.       turtle.turnRight()
  94.       t = 1
  95.     end
  96.   end
  97.   if turtle.getItemCount(16) > 0 then
  98.     turtle.turnLeft()
  99.     turtle.turnLeft()
  100.     for i=1,x do
  101.       if turtle.detect() then
  102.         turtle.dig()
  103.       end
  104.       turtle.forward()
  105.     end
  106.     turtle.select(2)
  107.     turtle.drop(64)
  108.     turtle.select(3)
  109.     turtle.drop(64)
  110.     turtle.select(4)
  111.     turtle.drop(64)
  112.     turtle.select(5)
  113.     turtle.drop(64)
  114.     turtle.select(6)
  115.     turtle.drop(64)
  116.     turtle.select(7)
  117.     turtle.drop(64)
  118.     turtle.select(8)
  119.     turtle.drop(64)
  120.     turtle.select(9)
  121.     turtle.drop(64)
  122.     turtle.select(10)
  123.     turtle.drop(64)
  124.     turtle.select(11)
  125.     turtle.drop(64)
  126.     turtle.select(12)
  127.     turtle.drop(64)
  128.     turtle.select(13)
  129.     turtle.drop(64)
  130.     turtle.select(14)
  131.     turtle.drop(64)
  132.     turtle.select(15)
  133.     turtle.drop(64)
  134.     turtle.select(16)
  135.     turtle.drop(64)
  136.     turtle.select(1)
  137.     turtle.turnLeft()
  138.     turtle.turnLeft()
  139.     for i=1,x do
  140.       turtle.forward()
  141.     end
  142.   end
  143. end
  144.  
  145.  
  146.  
  147. if x==y then
  148.   turtle.turnLeft()
  149.   turtle.turnLeft()
  150.   for i=1,x do
  151.     if turtle.detect() then
  152.       turtle.dig()
  153.     end
  154.     turtle.forward()
  155.   end
  156.   turtle.select(2)
  157.   turtle.drop(64)
  158.   turtle.select(3)
  159.   turtle.drop(64)
  160.   turtle.select(4)
  161.   turtle.drop(64)
  162.   turtle.select(5)
  163.   turtle.drop(64)
  164.   turtle.select(6)
  165.   turtle.drop(64)
  166.   turtle.select(7)
  167.   turtle.drop(64)
  168.   turtle.select(8)
  169.   turtle.drop(64)
  170.   turtle.select(9)
  171.   turtle.drop(64)
  172.   turtle.select(10)
  173.   turtle.drop(64)
  174.   turtle.select(11)
  175.   turtle.drop(64)
  176.   turtle.select(12)
  177.   turtle.drop(64)
  178.   turtle.select(13)
  179.   turtle.drop(64)
  180.   turtle.select(14)
  181.   turtle.drop(64)
  182.   turtle.select(15)
  183.   turtle.drop(64)
  184.   turtle.select(16)
  185.   turtle.drop(64)
  186.   print("I have finished your new Tunnel! All materials collected have been placed in the chest.")
  187.   print("The current remaining fuel level is")
  188.   print(f)
  189. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement