Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- p = peripheral.wrap("left")
- m = peripheral.find("monitor")
- cent = "100"
- function clear()
- m.clear()
- m.setCursorPos(1,1)
- term.setCursorPos(1,1)
- term.clear()
- end
- local x, y = m.getSize()
- local w2, h2 = term.getSize()
- while true do
- m.setBackgroundColor(colors.black)
- energy = p.getEnergy()
- max = p.getMaxEnergy()
- pourcent1 = energy/max
- pourcent2 = pourcent1*cent
- clear()
- m.write(energy.."/"..max)
- m.setCursorPos(1,3)
- m.write(pourcent2.."%")
- maxE = math.floor(max/2.5)
- curE = math.floor(energy/2.5)
- bar = math.floor(((curE/maxE)*(x-2))+0.5)
- stats = energy
- m.setCursorPos(2, y-2)
- m.setBackgroundColour(colors.gray)
- m.write(string.rep(" ",x-2))
- m.setCursorPos(2, y-2)
- m.setBackgroundColour(colors.green)
- m.write(string.rep(" ",bar))
- sleep(1)
- end
Add Comment
Please, Sign In to add comment