Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Place the Terminal Glasses Bridge to the RIGHT of the Advanced Computer
- --Place a Wired Modem to the back of the Advanced Computer and on one of the sides of your energy device
- --Connect the 2 Wired Modems with Networking Cables
- --Activate the Wired Modems by right clicking on them
- --You'll be given an ID when activating the modem. Replace 'idsu_0' with that ID.
- local msg
- local command
- local bridge = peripheral.wrap("right")
- local net = peripheral.wrap("back")
- local function idsu()
- bridge.clear()
- local width = 100
- local storageUnits = {
- {
- ["id"] = "idsu_2",
- ["name"] = "IDSU"
- }
- }
- local offset = 0
- for key, storageUnit in pairs(storageUnits) do
- pxOffset = offset * 20
- storageUnit["label"] = bridge.addText(4, 34 + pxOffset, storageUnit["name"], 0xFFFFFF)
- storageUnit["bar"] = bridge.addBox(4, 44 + pxOffset, 0, 5, 0xCC0000, 0.9)
- storageUnit["bar"].setZIndex(2)
- storageUnit["bg"] = bridge.addBox(4, 44 + pxOffset, width, 5, 0x000000, 0.5)
- offset = offset + 1
- end
- while true do
- for i=#storageUnits,1,-1 do
- storageUnit = storageUnits[i]
- if net.isPresentRemote(storageUnit["id"]) then
- capacity = net.callRemote(storageUnit["id"], "getCapacity")
- amount = net.callRemote(storageUnit["id"], "getStored")
- storageUnit["bar"].setWidth(width / capacity * amount)
- else
- storageUnit["bar"].delete()
- storageUnit["bg"].delete()
- storageUnit["label"].delete()
- table.remove(storageUnits, i)
- end
- end
- sleep(0.5)
- end
- end
- local function pullChat()
- local e
- e, msg = os.pullEvent("chat_command")
- end
- while true do
- if command == "idsu" then
- parallel.waitForAny(pullChat,idsu)
- else
- pullChat()
- end
- if msg == "idsu" then
- command = "idsu"
- elseif msg == "clear" then
- command = bridge.clear()
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement