Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Variables
- -- peripherals
- local bridge = peripheral.wrap("left")
- -- modem names
- local mfe = "mfe_0"
- local meSys = "appeng_me_tilecontroller_0"
- local rcTanks = "rc_irontankvavletile_1", "rc_irontankvalvetile_2", "rc_irontankvalvetile_3", "rc_irontankvalvetile_4"
- -- AE
- local itemID = 3 -- initialize to dirt
- local itemName = "Dirt"
- -- IC2
- -- RC
- -- 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(mfe, "getEUStored")
- local maxEU = peripheral.call(mfe, "getEUCapacity")
- ic2Text1.setText(currentEU.." EU")
- ic2Text2.setText(maxEU.." EU Max")
- end
- function calcAE()
- local storedItemCount = peripheral.call(meSys, "getStoredItemCount")
- local itemCount = peripheral.call(meSys, "countOfItemType",itemID,"0")
- local bytesFree = peripheral.call(meSys, "getFreeBytes")
- aeText1.setText(storedItemCount.." Items")
- aeText2.setText(itemCount.." "..itemName)
- 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()
- local firstParam = string.match(message, '[a-z]+')
- local secondParam = string.match(message, '%d+')
- local thirdParam = string.match(message, '[a-zA-Z]-$')
- 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
- elseif firstParam == "aeitemcount" then
- itemID = secondParam
- itemName = thirdParam
- calcAE()
- else
- -- Do Nothing
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment