Advertisement
DaddyTigerOf3

CC-AE2-Storage-Monitor

Mar 3rd, 2024 (edited)
918
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.60 KB | Gaming | 0 0
  1. local tpm = peripheral.wrap("back")
  2. local monitors = {
  3.     peripheral.wrap("top"),
  4. }
  5. while true do
  6.     local file = fs.open("max_storage.txt", "r")
  7.     local max_storage = tonumber(file.readLine())
  8.     file.close()
  9.     local total_used = 0
  10.     for i, item in ipairs(tpm.listAvailableItems()) do
  11.         total_used = total_used + item.count
  12.     end
  13.     for i, mon in ipairs(monitors) do
  14.         mon.clear()
  15.         mon.setCursorPos(1,1)
  16.         mon.write("Storage Used")
  17.         mon.setCursorPos(1,2)
  18.         mon.write(tostring(total_used) .. "/" .. tostring(max_storage))
  19.     end
  20.     os.sleep(1)
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement