Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ Config ]]--
- terminalSide = "bottom"
- wiredModemSide = "back"
- refreshTime = 1
- -- Time in seconds until the screen GUI refreshes
- AppliedEnergistics = true
- -- Gets the stored item count and turn red if full
- IndustrialCraft = true
- -- Gets the capacity | remaining amount of EU stored in your "MFSUs/Batboxes/MFEs/CESUs/"
- ThermalExpansion = true
- -- Gets capacity | remaining amount of MJ stored in your energy cells
- --[[ Tables ]]--
- EnergyUnits = {}
- AppliedStorage = {}
- MinecraftJoules = {}
- tArgs = { ... }
- --[[ Variables ]]--
- bridge = peripheral.wrap(terminalSide)
- net = peripheral.wrap(wiredModemSide)
- currentEU = 0
- maxEU = 0
- currentStorage = 0
- currentMJ = 0
- maxMJ = 0
- --[[ Functions ]]--
- function checkPeripherals()
- MinecraftJoules = {}
- EnergyUnits = {}
- MinecraftJoules = {}
- connectedPers = peripheral.getNames()
- for i=1, #connectedPers do
- if string.find(connectedPers[i], "mfsu") or string.find(connectedPers[i], "batbox") or string.find(connectedPers[i], "cesu") or string.find(connectedPers[i], "mfe") then
- table.insert(EnergyUnits, connectedPers[i])
- elseif string.find(connectedPers[i], "appeng") then
- table.insert(AppliedStorage, connectedPers[i])
- elseif string.find(connectedPers[i], "cofh_thermalexpansion") then
- table.insert(MinecraftJoules, connectedPers[i])
- end
- end
- end
- function displayText()
- bridge.clear()
- bridge.addText(3, 44, "Made by RandomShovel", math.random(0, 999999))
- if IndustrialCraft then
- cEU = bridge.addText(3, 16, "0", 0xFFFFFF)
- mEU = bridge.addText(3, 16, "0", 0xFFFFFF)
- divEU = bridge.addText(3, 16, "|", 0xFFFFFF)
- cEU.setZ(1)
- mEU.setZ(1)
- divEU.setZ(1)
- end
- if AppliedEnergistics then
- cAE = bridge.addText(5, 32, "0", 0xFFFFFF)
- cAE.setZ(1)
- end
- if ThermalExpansion then
- cMJ = bridge.addText(3, 74, "0", 0xFFFFFF)
- mMJ = bridge.addText(3, 74, "0", 0xFFFFFF)
- divMJ = bridge.addText(3, 74, "|", 0xFFFFFF)
- cMJ.setZ(1)
- mMJ.setZ(1)
- divMJ.setZ(1)
- end
- end
- function formNum(input)
- input2 = string.gsub(input, "(%d)(%d%d%d)$", "%1, %2", 1)
- while true do
- input2, found = string.gsub(input2, "(%d)(%d%d%d),", "%1, %2,", 1)
- if found == 0 then
- return input2
- end
- end
- end
- function grabData()
- if IndustrialCraft then
- for i = 1, #EnergyUnits do
- currentEU = currentEU + net.callRemote(EnergyUnits[i], "getEUStored")
- maxEU = maxEU + net.callRemote(EnergyUnits[i], "getEUCapacity")
- end
- fmaxEU = formNum(maxEU)
- fcurrentEU = formNum(currentEU)
- if currentEU >= maxEU then
- cEU.setText(""..fmaxEU)
- else
- cEU.setText(""..fcurrentEU)
- end
- divEU.setX(bridge.getStringWidth(fcurrentEU)-30)
- mEU.setX(bridge.getStringWidth(fcurrentEU)-24)
- mEU.setText(""..fmaxEU.." EU")
- end
- if AppliedEnergistics then
- for i = 1, #AppliedStorage do
- currentStorage = currentStorage + net.callRemote(AppliedStorage[i], "getStoredItemCount")
- end
- currentStorage = formNum(currentStorage)
- cAE.setText("AE | "..currentStorage.." Stored")
- if remainingStorage == 0 then
- cAE.setColor(0xFF0000)
- else
- cAE.setColor(0xFFFFFF)
- end
- end
- if ThermalExpansion then
- for i=1, #MinecraftJoules do
- if string.find(MinecraftJoules[i], "energycellcreative") then
- MJCreative = true
- currentMJ = "Infinite"
- break
- else
- MJCreative = false
- currentMJ = currentMJ + net.callRemote(MinecraftJoules[i], "getEnergyStored", "unknown")
- maxMJ = maxMJ + net.callRemote(MinecraftJoules[i], "getMaxEnergyStored", "unknown")
- end
- end
- fcurrentMJ = formNum(currentMJ)
- fmaxMJ = formNum(maxMJ)
- if MJCreative then
- cMJ.setText("Infinite")
- divMJ.setText("")
- mMJ.setText("")
- else
- if currentMJ >= maxMJ then
- cMJ.setText(""..fmaxMJ)
- else
- cMJ.setText(""..fcurrentMJ)
- end
- end
- if not MJCreative then
- divMJ.setText("|")
- divMJ.setX(bridge.getStringWidth(currentMJ)-15)
- mMJ.setX(bridge.getStringWidth(currentMJ)-9)
- mMJ.setText(""..fmaxMJ.." MJ")
- end
- end
- end
- function displayBars()
- if IndustrialCraft then
- EUBack.setZ(0)
- EUBar.setZ(1)
- EURatio = currentEU / maxEU
- EUWidth = 100 * EURatio
- EUBar.setWidth(EUWidth)
- end
- if AppliedEnergistics then
- AEBack.setZ(0)
- AEBack.setWidth(bridge.getStringWidth("AE | "..currentStorage.." Stored")-20)
- end
- if ThermalExpansion then
- MJBack.setZ(0)
- MJBar.setZ(1)
- if not MJCreative then
- MJRatio = currentMJ / maxMJ
- MJWidth = 100 * MJRatio
- MJBar.setWidth(MJWidth)
- else
- MJBar.setWidth(100)
- end
- end
- end
- function resetValues()
- -- I could've merged this with grabData(), but this is somewhat better in my opinion
- currentEU = 0
- maxEU = 0
- currentMJ = 0
- maxMJ = 0
- currentStorage = 0
- end
- --[[ Main ]]--
- term.clear()
- term.setCursorPos(1, 1)
- if #tArgs >= 1 then
- if string.lower(tArgs[1]) == "annoying" then
- printError("Message remove due to being annoying!")
- printError("Will now move on..")
- sleep(2)
- end
- end
- if #tArgs == 0 then
- print("By default, the glasses bridge must be on the right")
- print("By default, the wired modem must be on the back")
- print("Do you want to edit that?")
- write("> ")
- response = read()
- if response == "Yes" or response == "yes" then
- term.clear()
- term.setCursorPos(1, 1)
- print("Opening config...")
- sleep(2)
- shell.run("edit", shell.getRunningProgram())
- end
- end
- term.clear()
- term.setCursorPos(1, 1)
- textutils.slowPrint("Activating GUI...")
- sleep(1)
- term.clear()
- term.setCursorPos(1, 1)
- print("GUI Activated")
- displayText()
- AEBack = bridge.addGradientBox(3, 30, 0, 11, 0x666666, 0.5, 0x999999, 0.5, 1)
- EUBar = bridge.addGradientBox(4, 3, 0, 10, 0x0000FF, 0.5, 0x99FFFF, 0.7, 1)
- EUBack = bridge.addGradientBox(3, 2, 102, 12, 0x666666, 0.5, 0x999999, 0.5, 1)
- MJBack = bridge.addGradientBox(3, 60, 102, 12, 0x666666, 0.5, 0x999999, 0.5, 1)
- MJBar = bridge.addGradientBox(4, 61, 0, 10, 0x0000FF, 0.5, 0x99FFFF, 0.7, 1)
- while true do
- resetValues()
- checkPeripherals()
- grabData()
- displayBars()
- sleep(refreshTime)
- end
Advertisement
Add Comment
Please, Sign In to add comment