Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- percent = 0
- max = 0
- cur = 0
- function updateData()
- local p = peripheral.find("draconic_rf_storage")
- local m = peripheral.find("monitor")
- if m ~= nil then
- if p ~= nil then
- m.setTextScale(0.5)
- max = p.getMaxEnergyStored()
- cur = p.getEnergyStored()
- percent = cur / max
- local width , height = m.getSize()
- local letters = math.floor((width - 4) * percent)
- local spaces = (with - 4) - letters
- m.setCursorPos(1, 1)
- local l_active = ""
- while string.len(l_active) < letters do
- l_active ..= "|"
- end
- while string.len(l_space) < spaces do
- l_space ..= "."
- end
- m.setTextColor(colors.lime)
- m.write(l_active)
- m.setTextColor(colors.gray)
- m.write(l_space)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement