Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gui = peripheral.wrap("top")
- modem = peripheral.wrap("bottom")
- cells = modem.getNamesRemote()
- lastTotal = 0
- maxPower = 600000*(#cells)
- gui.clear()
- box = gui.addBox(95,25,50,14,0xffffff,.2)
- label = gui.addText(100,30,"",0x000000)
- function round(n)
- return math.floor(n*10)/10
- end
- while true do
- sleep(1)
- total = 0
- for i,v in ipairs(cells) do
- total = total + modem.callRemote(v,"getEnergyStored")
- end
- powerNet = round((total - lastTotal) / 20)
- powerPercent = round(total / maxPower * 100)
- text = "POWER: " .. total .. " (" .. powerPercent .. "%) NET: " .. powerNet
- label.setText(text)
- box.setWidth(gui.getStringWidth(text)+10)
- lastTotal = total
- --if #(gui.getAllIds()) > 2 then
- -- gui.clear()
- -- box = gui.addBox(95,25,gui.getStringWidth(text)+10,14,0xffffff,.2)
- -- label = gui.addText(100,30,text,0x000000)
- --end
- end
Advertisement
Add Comment
Please, Sign In to add comment