emagiannu

PIM Inventory Clear

Jan 24th, 2016
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.40 KB | None | 0 0
  1. pim = "right"
  2. chest = "north"
  3.  
  4. p = peripheral.wrap(pim)
  5.  
  6. while true do
  7.   if p.getInventorySize() > 0 then
  8.     c = 0
  9.    
  10.     for i = 1, p.getInventorySize() do
  11.       if i < 40 and p.getStackInSlot(i) ~= nil  then
  12.         p.pushItem(chest, i)
  13.         c = c + 1
  14.       end
  15.     end
  16.     if c > 0 then
  17.       print("Moved " .. c .. " items from " .. p.getInventoryName())
  18.     end
  19.   end
  20.   sleep(1)
  21. end
Add Comment
Please, Sign In to add comment