---------------------------------- -- Elite's DE Energy Reader -- --Motified from Hypnotized's code-- ----------------------------------- mon = peripheral.wrap("right") term.redirect(mon) local refreshRate = 1 local prevEnergyStored = 0 local diff = 0 local function comma_value(amount) local formatted = amount local k = 0 while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k == 0) then break end end return formatted end --TitleBar function titleBar() term.setCursorPos(1,1) term.setBackgroundColor(colors.blue) term.setTextColor(colors.lightGray) term.clearLine() term.setCursorPos(2,1) print("Draconic Evo Energy Monitor") end while true do rednet.open("top") local id, msg = rednet.receive() local t = textutils.unserialize(msg) -- print(t[0]) == getEnergyStored -- print(t[1]) == getMaxEnergyStored local energyStored = t[0] local maxEnergyStored = t[1] local percent = energyStored/maxEnergyStored*100 diff = (energyStored - prevEnergyStored)/(refreshRate*20) --Print Stuff to the screen term.clear() titleBar() term.setBackgroundColor(colors.black) term.setCursorPos(1,3) term.setTextColor(colors.red) print(" Max Energy: "..comma_value(maxEnergyStored)) term.setCursorPos(1,5) term.setTextColor(colors.green) print("Current Energy: "..comma_value(energyStored).." ") term.setCursorPos(1,6) print(" ("..percent.."%)") print() if (diff > 0) then print(" Avg. RF/t: +"..comma_value(diff)) else term.setTextColor(colors.red) print(" Avg. RF/t: "..comma_value(diff)) end prevEnergyStored = energyStored os.sleep(refreshRate) end