Slinger0001

Turtle Lava

Dec 5th, 2020 (edited)
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.97 KB | None | 0 0
  1. --0GLmSd2T
  2. shell.run('clear')
  3. local Fuel = turtle.getFuelLevel()
  4. print("Current Fuel Level " ..Fuel)
  5.  
  6. local counter=0
  7. local direction = 0
  8. local widthcount=0
  9. local countupheight = 0
  10. local countdownheight=0
  11. local backhome=0    
  12.  
  13.     print("Enter length")
  14.     local length = io.read()
  15.     length = tonumber(length)
  16.     print("Enter width")
  17.     local width = io.read()
  18.     width=tonumber(width)
  19.     print("Enter height")
  20.     local height = io.read()
  21.     height=tonumber(height)
  22.  
  23. if Fuel>0 then
  24.     turtle.forward()
  25.     while counter<length do
  26.         Fuel = turtle.getFuelLevel()
  27.         print("Fuel is " .. Fuel)
  28.         while countdownheight<height do
  29.             turtle.refuel()
  30.             turtle.placeDown(1)
  31.             turtle.refuel()
  32.             turtle.down()
  33.             countdownheight = countdownheight+1
  34.         end  
  35.         countupheight=countdownheight
  36.         while countupheight>0 do
  37.             turtle.up()
  38.             countupheight=countupheight-1    
  39.         end  
  40.         counter = counter+1
  41.         countupheight=0
  42.         countdownheight=0
  43.         turtle.forward(1)
  44.         if counter==length then
  45.             if widthcount<width then
  46.                 if direction==0 then
  47.                     turtle.turnRight()
  48.                     turtle.forward(1)
  49.                     turtle.turnRight()
  50.                     direction=1
  51.                     counter=0
  52.                     widthcount = widthcount+1
  53.                 else
  54.                     turtle.turnLeft()
  55.                     turtle.forward()
  56.                     turtle.turnLeft()
  57.                     direction=0
  58.                     counter=0
  59.                     widthcount = widthcount+1
  60.                 end
  61.             end
  62.         end
  63.     end
  64.     turtle.forward()
  65.     turtle.turnRight()
  66.     while backhome<width do
  67.         turtle.forward()
  68.         backhome=backhome+1
  69.     end
  70. else
  71.     Fuel = turtle.getFuelLevel()
  72.     if Fuel<500 then
  73.     turtle.refuel()
  74.     end
  75.  
  76. end
Add Comment
Please, Sign In to add comment