Advertisement
MJRLegends

Crystal Tank Storage Monitor - OpenComputers

Nov 2nd, 2015
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.94 KB | None | 0 0
  1. local term = require("term")
  2. local component = require("component")
  3. term.clear()
  4. print("Getting GPU's")
  5. local gpu = component.gpu
  6. local t2gpu = ""
  7. for addr in component.list("gpu")
  8.     do
  9.         local herp,derp = component.proxy(addr).maxResolution()
  10.         if herp == 80 and derp == 25
  11.             then t2gpu = addr
  12.     end
  13. end
  14. t2gpu = component.proxy(t2gpu)
  15. print("Setting Screens to GPU's")
  16. gpu.bind("ebb2f831-6176-4015-894e-15483b0fb590")
  17. t2gpu.bind("e3b8edaf-1805-43d2-ba14-7e89bfc9dad2")
  18. print("Setting Resolutions")
  19. gpu.setResolution(80,25)
  20. t2gpu.setResolution(45,15)
  21. os.sleep(5)
  22. while true do
  23.     term.clear()
  24.     print("Getting Tanks")
  25.     local tank1 = component.invoke("cdd816d3-a080-43bd-bef2-0d542ed33ef7", "getTankFraction") * 100
  26.     local value = math.floor(tank1)
  27.     print("Lava Tank : " .. tank1 .. "% full")
  28.     t2gpu.setForeground(0xFF25FF)
  29.     t2gpu.set(1, 1, "Lava Tank: ")
  30.     t2gpu.setForeground(0xFFFFFF)
  31.     t2gpu.set(1, 2, value .. "%")
  32.     os.sleep(2)
  33. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement