Advertisement
NeoGriever

Untitled

Jul 18th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. percent = 0
  2. max = 0
  3. cur = 0
  4. function updateData()
  5. local p = peripheral.find("draconic_rf_storage")
  6. local m = peripheral.find("monitor")
  7. if m ~= nil then
  8. if p ~= nil then
  9. m.setTextScale(0.5)
  10. max = p.getMaxEnergyStored()
  11. cur = p.getEnergyStored()
  12. percent = cur / max
  13. local width , height = m.getSize()
  14. local letters = math.floor((width - 4) * percent)
  15. local spaces = (with - 4) - letters
  16. m.setCursorPos(1, 1)
  17. local l_active = ""
  18. while string.len(l_active) < letters do
  19. l_active ..= "|"
  20. end
  21. while string.len(l_space) < spaces do
  22. l_space ..= "."
  23. end
  24. m.setTextColor(colors.lime)
  25. m.write(l_active)
  26. m.setTextColor(colors.gray)
  27. m.write(l_space)
  28. end
  29. end
  30. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement