Sammyyob

1 item automation

Apr 29th, 2021 (edited)
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.75 KB | None | 0 0
  1. machine = peripheral.wrap("front")
  2.  
  3. while true do
  4.     if(turtle.suckUp(1)) then
  5.         oldItem = turtle.getItemDetail(1).name
  6.         currentItem = oldItem
  7.         print("old item: " .. oldItem)
  8.         turtle.drop(1)
  9.        
  10.         while (oldItem == currentItem) do
  11.             sleep(0.1)
  12.            
  13.             while (machine.getItemDetail(1) == nil) do
  14.                 sleep(0.1)
  15.             end
  16.            
  17.             currentItem = machine.getItemDetail(1).name
  18.         end
  19.        
  20.         print("finished")
  21.        
  22.         x = 0
  23.         while (turtle.suck(1)) do
  24.             x = x + 1
  25.         end
  26.  
  27.         turtle.turnLeft()
  28.         turtle.drop(x)
  29.         turtle.turnRight()
  30.         print("dropped amount: " .. x)
  31.     end
  32. end
Add Comment
Please, Sign In to add comment