Advertisement
Slinger0001

Untitled

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