Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -------------
- -- Config --
- -------------
- terminalSide = "right"
- wiredModemSide = "back"
- refreshTime = 1
- -- Time in seconds until the screen GUI refreshes
- AppliedEnergistics = false
- -- Gets the used | max storage in your AE system
- -- Currently doesn't have a bar
- ThermalExpansion = false
- -- Gets the capacity | max amount of MJ stored in your energy cells
- IndustrialCraft = false
- -- Gets the capacity | remaining amount of EU stored in your "Batboxes"
- --------------
- -- Tables --
- --------------
- EnergyUnits = {}
- MinecraftJoules = {}
- AppliedStorage = {}
- -- All units must be in ""s and separated by a ,
- ---------------
- -- Variables --
- ---------------
- bridge = peripheral.wrap(tostring(terminalSide))
- net = peripheral.wrap(tostring(wiredModemSide))
- currentEU = 0
- currentMJ = 0
- currentStorage = 0
- maxEU = 0
- maxMJ = 0
- maxStorage = 0
- -----------------
- -- Functions --
- -----------------
- function displayText()
- bridge.clear()
- if IndustrialCraft == true then
- cEU = bridge.addText(3, 16, "0", 0xFFFFFF)
- mEU = bridge.addText(3, 16, "0", 0xFFFFFF)
- divEU = bridge.addText(3, 16, "|", 0xFFFFFF)
- cEU.setZIndex(1)
- mEU.setZIndex(1)
- divEU.setZIndex(1)
- end
- if ThermalExpansion == true then
- cMJ = bridge.addText(4, 40, "0", 0xFFFFFF)
- mMJ = bridge.addText(4, 40, "0", 0xFFFFFF)
- divMJ = bridge.addText(4, 40, "|", 0xFFFFFF)
- cMJ.setZIndex(1)
- mMJ.setZIndex(1)
- divMJ.setZIndex(1)
- end
- if AppliedEnergistics == true then
- cAE = bridge.addText(4, 64, "0", 0xFFFFFF)
- mAE = bridge.addText(4, 64, "0", 0xFFFFFF)
- divAE = bridge.addText(4, 64, "|", 0xFFFFFF)
- cAE.setZIndex(1)
- mAE.setZIndex(1)
- divAE.setZIndex(1)
- end
- end
- function grabData()
- if IndustrialCraft == true then
- for i = 1, #EnergyUnits do
- currentEU = currentEU + net.callRemote(EnergyUnits[i], "getStored")
- maxEU = maxEU + net.callRemote(EnergyUnits[i], "getCapacity")
- end
- cEU.setText(""..currentEU)
- divEU.setX(string.len(currentEU)*6 + 8)
- mEU.setX(string.len(currentEU)*6 + 14)
- mEU.setText(""..maxEU.." EU")
- end
- if ThermalExpansion == true then
- for i = 1, #MinecraftJoules do
- currentMJ = currentMJ + net.callRemote(MinecraftJoules[i], "getEnergyStored")
- maxMJ = maxMJ + net.callRemote(MinecraftJoules[i], "getMaxEnergyStored")
- end
- cMJ.setText(""..currentMJ)
- divMJ.setX(string.len(currentMJ)*6 + 8)
- mMJ.setX(string.len(currentMJ)*6 + 14)
- mMJ.setText(""..maxMJ.." MJ")
- end
- if AppliedEnergistics == true then
- for i = 1, #AppliedStorage do
- currentStorage = currentStorage + net.callRemote(AppliedStorage[i], "getStoredItemCount")
- maxStorage = maxStorage + net.callRemote(AppliedStorage[i], "getRemainingItemCount")
- end
- cAE.setText(""..currentStorage)
- divAE.setX(string.len(currentStorage)*6 + 8)
- mAE.setX(string.len(currentStorage)*6 + 14)
- mAE.setText(""..maxStorage.." Stored")
- end
- end
- function displayBars()
- if IndustrialCraft == true then
- EUBar = bridge.addGradientBox(4, 3, 0, 10, 0x0000FF, 0.5, 0x999999, 0.7, 1)
- EUBack = bridge.addGradientBox(3, 2, 102, 12, 0x666666, 0.5, 0x999999, 0.5, 1)
- EUBack.setZIndex(0)
- EUBar.setZIndex(1)
- EURatio = currentEU / maxEU
- EUWidth = 100 * EURatio
- EUBar.setWidth(EUWidth)
- end
- if ThermalExpansion == true then
- MJBar = bridge.addGradientBox(4, 27, 0, 10, 0x0000FF, 0.5, 0x999999, 0.7, 1)
- MJBack = bridge.addGradientBox(3, 26, 102, 12, 0x666666, 0.5, 0x999999, 0.5, 1)
- MJBack.setZIndex(0)
- MJBar.setZIndex(1)
- MJRatio = currentMJ / maxMJ
- MJWidth = 100 * MJRatio
- MJBar.setWidth(MJWidth)
- end
- end
- function resetValues()
- -- I could've merged this with grabData(), but this is somewhat better in my opinion
- currentEU = 0
- currentMJ = 0
- currentStorage = 0
- maxEU = 0
- maxMJ = 0
- maxStorage = 0
- end
- ------------
- -- Main --
- ------------
- term.clear()
- term.setCursorPos(1, 1)
- 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())
- else
- term.clear()
- term.setCursorPos(1, 1)
- print("Activating GUI")
- sleep(2)
- term.clear()
- term.setCursorPos(1, 1)
- print("GUI Activated")
- while true do
- displayText()
- grabData()
- displayBars()
- bridge.addText(6, 90, "Made by RandomShovel", 0xFF0000)
- sleep(refreshTime)
- resetValues()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement