GNOOR1S

Computer Craft Turtle Wall Builder

Apr 21st, 2021 (edited)
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.81 KB | None | 0 0
  1. local tArgs = {...}
  2. local length = tArgs[1]
  3. local height = tArgs[2]
  4.  
  5. local currentSlot = 1
  6. local running = true
  7.  
  8. function fuel()
  9.     if turtle.getFuelLevel() < 10 then
  10.         turtle.select(16)
  11.         turtle.refuel(1)
  12.         turtle.select(currentSlot)
  13.     end
  14. end
  15.  
  16. function checkSlots()
  17.     if turtle.getItemCount(turtle.getSelectedSlot()) < 1 then
  18.         currentSlot = currentSlot + 1
  19.         if currentSlot < 15 then
  20.             turtle.select(currentSlot)
  21.         else
  22.             running = false
  23.             print("HAVE RUN OUT  OF ITEMS")
  24.         end
  25.     end
  26. end
  27.  
  28. function run()
  29.     fuel()
  30.     turtle.up()
  31.     checkSlots()
  32.     for y = 1, height do
  33.         for x = 1, length do
  34.             checkSlots()
  35.             fuel()
  36.             turtle.placeDown()
  37.             if x < tonumber(length) then
  38.                 turtle.forward()
  39.             end
  40.         end
  41.         fuel()
  42.         turtle.turnLeft()
  43.         turtle.turnLeft()
  44.         turtle.up()
  45.     end
  46.  
  47. end
  48.  
  49. run()
Add Comment
Please, Sign In to add comment