Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cell = peripheral.wrap("draconic_rf_storage_0")
- mon = peripheral.wrap("right")
- maxE = "2.14 trillion rf/t"
- curE = cell.getEnergyStored()
- eStored = ""
- eGained = ""
- status = ""
- ePrintStored = ""
- function main()
- mon.clear()
- staticDisplay()
- eFirstStored = cell.getEnergyStored()
- sleep(1)
- eSecondStored = cell.getEnergyStored()
- -------------------------------------------------------------------------------------------
- -- Shortened length for Energy value
- -------------------------------------------------------------------------------------------
- eStoredToString = tostring(eStored)
- eSub = eStoredToString
- if string.len(eSub) <= 6 then
- ePrintStored = string.sub(eSub, 4).."Thousand rf"
- elseif string.len(eSub) <= 7 and string.len(esub) >= 9 then
- ePrintStored = string.sub(eSub, 7).."Mil rf" 100-
- elseif string.len(esub) <= 9 and string.len(esub) >= 12 then
- ePrintStored = string.sub(eSub, 10).. "Bil rf"
- elseif string.len == 13 then
- ePrintStored = string.sub(13).. "Tril rf"
- end
- -------------------------------------------------------------------------------------------
- -- Get Energy created per second
- -------------------------------------------------------------------------------------------
- if eFirstStored < eSecondStored then
- eGain = eSecondStored - eFirstStored
- eGainToString = tostring(eGain)
- if string.len(eGainToString) <= 6 then
- eGainToString = string.sub(eSub, 4).."Thousand rf"
- elseif string.len(eGainToString) <= 7 and string.len(eGainToString) >= 9 then
- ePrintGained = string.sub(eSub, 7).."Mil rf"
- elseif string.len(eGainToString) <= 9 and string.len(eGainToString) >= 12 then
- ePrintGained = string.sub(eSub, 10).. "Bil rf"
- elseif string.len(eGainToString) == 13 then
- ePrintGained = string.sub(eSub, 13).. "Tril rf"
- end
- end
- if curE < 1000000000 then
- redstone.setBundledOutput("bottom", colors.black)
- status = "Active"
- elseif curE > 1000000000 then
- redstone.setBundledOutput("bottom", colors.0)
- status = "Inactive"
- end
- end
- function staticDisplay()
- mon.clear()
- main()
- mon.setTextColor(colors.white)
- mon.setBackgroundColor(colors.black)
- mon.setTextScale(1)
- mon.setCursorPos(8,1)
- mon.write("Power Storage Monitor")
- mon.setCursorPos(1,4)
- mon.write("Energy Stored: "..ePrintStored)
- mon.setCursorPos(1,6)
- mon.write("Energy Gained: "..ePrintGained)
- mon.setCursorPos(1,10)
- mon.write("Generator Status: "..status)
- end
- while true do
- staticDisplay()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement