albin900

Turtle dig 10x10

Dec 8th, 2013
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.16 KB | None | 0 0
  1. turtle.refuel()
  2. ai = 10
  3. t = 0
  4. i = 0
  5. turn = "right"
  6. no = "false"
  7. while true do
  8.         if turtle.getFuelLevel() < 10 then
  9.             turtle.refuel()
  10.         end
  11.  
  12.         if t > 9 then
  13.         turtle.turnLeft()
  14.             for i=1,10 do
  15.                 turtle.forward()
  16.                 turtle.dig()
  17.             end
  18.  
  19.            
  20.  
  21.         turtle.turnRight()
  22.         turtle.digDown()
  23.         turtle.down()  
  24.         turtle.dig()
  25.         turtle.forward()
  26.  
  27.         turtle.turnLeft()
  28.         turtle.turnLeft()
  29.         turtle.select(2)
  30.         turtle.place()
  31.         turtle.select(1)
  32.         turtle.turnRight()
  33.         turtle.turnRight()
  34.         t = 0
  35.         i = 1
  36.         end
  37.     print("Turn: ")
  38.     print(t)
  39.     print(" ------- ")
  40.     print("Block: ")
  41.     print(i)
  42.     no = false
  43.     turtle.dig()
  44.     turtle.forward()
  45.     i = i+1
  46.     if i > 9 then
  47.         print("Turning...")
  48.         print(turn)
  49.         if turn == "right" then
  50.             turtle.turnRight()
  51.             turtle.dig()
  52.             turtle.forward()
  53.             turtle.turnRight()
  54.             turn = "left"
  55.             no = "true"
  56.             i = 0
  57.             t = t+1
  58.             print("Turned right!")
  59.         end
  60.  
  61.         if turn == "left" then
  62.             if no == "true" then
  63.                
  64.             else
  65.                 print("Turned left!")
  66.                 turtle.turnLeft()
  67.                 turtle.dig()
  68.                 turtle.forward()
  69.                 turtle.turnLeft()
  70.                 turn = "right"
  71.                 i = 0
  72.                 no = "true"
  73.                 t = t+1
  74.  
  75.             end
  76.         end
  77.     end
  78. end
Advertisement
Add Comment
Please, Sign In to add comment