toastonrye

Adv Peripherals Inventory Dump v1 Youtube

Jul 10th, 2022 (edited)
1,791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.77 KB | None | 0 0
  1. --dumper program for Youtube
  2. --by toastonrye
  3.  
  4. local im = peripheral.find("inventoryManager")
  5. local cb = peripheral.find("chatBox")
  6.  
  7. if im == nil then error("the inventory manager not found") end
  8. if cb == nil then error("chatBox not found") end
  9.  
  10. print("Running dumper")
  11.  
  12. while true do
  13.  
  14.     local e, player, msg = os.pullEvent("chat")
  15.     if msg == "dump" and player == "toastonrye" then
  16.         print("Dumping slots 9 through 26")
  17.         myInv = im.getItems()
  18.         local foo = {}
  19.         for k,v in pairs(myInv) do
  20.             table.insert(foo,k,v.count)  
  21.         end
  22.         for k,v in pairs(foo) do
  23.             if k>=9 and k<=26 then
  24.                 print(k..": "..v)
  25.                 im.removeItemFromPlayer("EAST",v,k)
  26.             end
  27.         end
  28.     end
  29. end
Add Comment
Please, Sign In to add comment