CmdDebugs

trainBridgeTopV2

Apr 17th, 2021
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. turtle.select(1)
  2.  
  3. function check_inventory()
  4.     local all_empty = false
  5.  
  6.     while turtle.getItemCount(turtle.getSelectedSlot()) <= 0 do
  7.         print('Moving slot')
  8.         if turtle.getSelectedSlot() >= 16 then
  9.             turtle.select(1)
  10.             if all_empty then
  11.                 print('All inventory slots empty, shutting down')
  12.                 exit()
  13.             end
  14.             all_empty = true
  15.         end
  16.         turtle.select(turtle.getSelectedSlot()+1)
  17.     end
  18. end
  19.  
  20. bigSleep = false
  21.  
  22. while true do
  23.     while turtle.detectDown() do
  24.         sleep(0.5)
  25.         bigSleep = true
  26.     end
  27.  
  28.     if bigSleep then
  29.         sleep(5.0)
  30.         bigSleep = false
  31.     end
  32.  
  33.     check_inventory()
  34.  
  35.     turtle.placeUp()
  36.     turtle.forward()
  37. end
Add Comment
Please, Sign In to add comment