Advertisement
Guest User

build

a guest
Jul 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.17 KB | None | 0 0
  1. turtle.refuel()
  2.  
  3. local running = true
  4. print("Tower Time!")
  5.  
  6. local slot = 2
  7.  
  8. function forward()
  9.   checkSlot()
  10.   turtle.forward()
  11.   turtle.placeDown()
  12. end
  13.  
  14. function left()
  15.   checkSlot()
  16.   turtle.turnLeft()
  17.   turtle.forward()
  18.   turtle.placeDown()
  19. end
  20.  
  21. function right()
  22.   checkSlot()
  23.   turtle.turnRight()
  24.   turtle.forward()
  25.   turtle.placeDown()
  26. end
  27.  
  28. function checkSlot()
  29.     if (not turtle.getItemDetail()) and slot == 16 then
  30.       print("Out of Items")
  31.       running = false
  32.     elseif (not turtle.getItemDetail()) then
  33.       slot = slot + 1
  34.      
  35.       if (not turtle.getItemDetail()) then
  36.         running = false
  37.         print('Next slot empty, quitting')
  38.       end
  39.     end
  40. end
  41.  
  42. while running and not (turtle.detect() and turtle.detectUp()) do
  43.   print("Curr Slot: ", slot)
  44.   turtle.select(slot)
  45.   checkSlot()
  46.   turtle.up()
  47.   turtle.placeDown()
  48.  
  49.   for i = 1, 4 do
  50.     forward()
  51.     forward()
  52.     forward()
  53.     right()
  54.     left()
  55.     forward()
  56.     right()
  57.     left()
  58.     right()
  59.     left()
  60.     right()
  61.     left()
  62.     right()
  63.     left()
  64.     right()
  65.     forward()
  66.     left()
  67.     right()
  68.     forward()
  69.     forward()
  70.   end
  71. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement