Advertisement
Guest User

test

a guest
Oct 19th, 2014
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.38 KB | None | 0 0
  1. local sides = { "left", "right", "top",
  2.   "bottom", "front", "back" }
  3. local mon = peripheral.wrap("back")
  4.  
  5. os.loadAPI("ProgressBar")
  6. ProgressBar.SetPeripheral("back")
  7.  
  8. function checkIsSide(str)
  9.   for i=1, #sides do
  10.     if str == sides[i] then return true end
  11.   end
  12.   return false
  13. end
  14.  
  15.  
  16. local num = 0
  17. mon.setTextScale(2)
  18. while true do
  19.   peripherals = peripheral.getNames()
  20.   num = 0
  21.   for i=1, #peripherals do
  22.     local name = peripherals[i]
  23.     local displayName = peripherals[i]
  24.     if checkIsSide(name) == false then
  25.           num = num + 1
  26.          
  27.       if string.find(name, "tank") then
  28.         tank = peripheral.wrap(name)
  29.         info = tank.getTankInfo("unknown")
  30.         local max = 0
  31.         local current = 0
  32.         for u, v in pairs(info) do
  33.           for column,data in pairs(v) do            
  34.             print(column..
  35.               ": "..data)
  36.             if column == "capacity" then
  37.               max = data
  38.             elseif column == "amount" then
  39.               current = data
  40.             elseif column == "rawName" then
  41.               mod = data.."                             "
  42.               displayName = mod
  43.             end
  44.           end
  45.         end
  46.       mon.setCursorPos(1, num)
  47.       mon.write(displayName)
  48.       ProgressBar.SetTable(name, max, current, 15, 25, num)
  49.          ProgressBar.DrawToPeripheral()
  50.       end
  51.     end
  52.   end  
  53.   break
  54. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement