Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- -- peripherals
- local bridge = peripheral.wrap("left")
- -- names
- local mfsu = "mfsu_0"
- local meChest = "me_chest_0"
- -- colors
- local red = 0xFF0000
- local yellow = 0xFFFF00
- local black = 0x000000
- -- update delay(lower the more updates)
- local delay = 1 --1 second
- -- Functions
- function IC2Box()
- ic2Box = bridge.addBox(5, 5, 100, 50, black, 0.5)
- ic2TextHeader = bridge.addText(48, 5, "IC2", red)
- ic2Text1 = bridge.addText(5, 15, "", yellow)
- ic2Text2 = bridge.addText(5, 25, "", yellow)
- end
- function IC2Clear()
- ic2Text1.setText("")
- ic2Text2.setText("")
- ic2TextHeader.setText("")
- ic2Box.setOpacity(0)
- end
- function AEBox()
- aeBox = bridge.addBox(5, 65, 100, 50, black, 0.5)
- aeTextHeader = bridge.addText(49, 65, "AE", red)
- aeText1 = bridge.addText(5, 75, "", yellow)
- aeText2 = bridge.addText(5, 85, "", yellow)
- aeText3 = bridge.addText(5, 95, "", yellow)
- end
- function AEClear()
- aeText1.setText("")
- aeText2.setText("")
- aeText3.setText("")
- aeTextHeader.setText("")
- aeBox.setOpacity(0)
- end
- function calcIC2()
- local currentEU = peripheral.call(mfsu, "getEUStored")
- local maxEU = peripheral.call(mfsu, "getEUCapacity")
- ic2Text1.setText(currentEU.." EU")
- ic2Text2.setText(maxEU.." EU Max")
- end
- function calcAE()
- local storedItemCount = peripheral.call(meChest, "getStoredItemCount")
- local dirtCount = peripheral.call(meChest, "countOfItemType","3","0")
- local bytesFree = peripheral.call(meChest, "getFreeBytes")
- aeText1.setText(storedItemCount.." Items")
- aeText2.setText(dirtCount.." Dirt")
- aeText3.setText(bytesFree.." bytes free")
- end
- -- initialize
- local ic2HUD = true
- local aeHUD = true
- bridge.clear()
- IC2Box()
- AEBox()
- -- loop
- while true do
- local myTimer = os.startTimer(delay)
- local event, message = os.pullEvent()
- if ic2HUD == true then calcIC2() end
- if aeHUD == true then calcAE() end
- if event == "chat_command" then
- if message == "ic2off" then
- IC2Clear()
- ic2HUD = false
- elseif message == "aeoff" then
- AEClear()
- aeHUD = false
- elseif message == "ic2on" then
- calcIC2()
- ic2TextHeader.setText("IC2")
- ic2Box.setOpacity(0.5)
- ic2HUD = true
- elseif message == "aeon" then
- calcAE()
- aeTextHeader.setText("AE")
- aeBox.setOpacity(0.5)
- aeHUD = true
- else
- -- Do Nothing
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment