CmdDebugs

trainBridgeSideV2

Apr 17th, 2021 (edited)
102
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.     local data = turtle.getItemDetail(turtle.getSelectedSlot())
  6.  
  7.     while (turtle.getItemCount(turtle.getSelectedSlot())) <= 0 or (data.name == "minecraft:magma_block") do
  8.         print('Moving slot')
  9.         if turtle.getSelectedSlot() >= 16 then
  10.             turtle.select(1)
  11.             if all_empty then
  12.                 print('All inventory slots empty, shutting down')
  13.                 exit()
  14.             end
  15.             all_empty = true
  16.         end
  17.         turtle.select(turtle.getSelectedSlot()+1)
  18.         data = turtle.getItemDetail(turtle.getSelectedSlot())
  19.     end
  20. end
  21.  
  22. bigSleep = false
  23.  
  24. side = read()
  25.  
  26. while true do
  27.     while turtle.detect() do
  28.         sleep(0.5)
  29.         bigSleep = true
  30.     end
  31.  
  32.     if bigSleep then
  33.         sleep(5.0)
  34.         bigSleep = false
  35.     end
  36.  
  37.     check_inventory()
  38.  
  39.     if side == "l" then
  40.         turtle.turnLeft()
  41.         turtle.place()
  42.         turtle.turnRight()
  43.         turtle.forward()
  44.     else
  45.         turtle.turnRight()
  46.         turtle.place()
  47.         turtle.turnLeft()
  48.         turtle.forward()
  49.     end
  50. end
Add Comment
Please, Sign In to add comment