Advertisement
Guest User

counter

a guest
Aug 20th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.03 KB | None | 0 0
  1. component = require("component")
  2. inv = component.inventory_controller
  3. gpu = component.gpu
  4. sides = require("sides")
  5. inv2 = inv.getAllStacks(sides.front)
  6. term = require("term")
  7. colors = require("colors")
  8. local width, height = gpu.getResolution()
  9. while true do
  10.   inv = component.inventory_controller
  11.   chests = {}
  12.   for i = 0, 5 do
  13.     s = inv.getAllStacks(i)
  14.     if s ~= nil then
  15.       chests[#chests + 1] = s
  16.     end
  17.   end
  18.   os.sleep(5)
  19.   count = 0
  20.   for val, chest in pairs(chests) do
  21.     for i, v in pairs(chest.getAll()) do
  22.       if v["label"] == "Omnidollar [100]" then
  23.         count = count + 100 * v["size"]
  24.       elseif v["label"] == "Omniquarter [25]" then
  25.         count = count + 25 * v["size"]
  26.       elseif v["label"] == "Omninickel [5]" then
  27.         count = count + 5 * v["size"]
  28.       elseif v["label"] == "Omnipenny [1]" then
  29.         count = count + 1 * v["size"]
  30.       end
  31.     end
  32.   end
  33.   term.clear()
  34.   gpu.setResolution(10, 8)
  35.   local width, height = gpu.getResolution()
  36.   print("\n\n\n"..tostring(math.floor(count)))
  37.   print("OmniCoins")
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement