Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local red = redstone
- local modemWire = peripheral.wrap("left")
- local monitor = peripheral.wrap("back")
- local green = 32
- local red = 16384
- local defColor = 1
- local basePort = 228
- local status = {farm = false, ME = false, security = false, dataStorage = false, enigma = false, RAD2 = false, GPSRadar = false, GPSRadarStat = "GPS "}
- if monitor.isColor() == false then
- print("Kupi sebe novui monitor, bomzhara")
- return 0
- end
- monitor.setTextScale(1)
- monitor.setCursorBlink(false)
- function recv (timeout)
- os.startTimer(timeout)
- while true do
- local sEvent, p1, p2, p3, p4, p5 = os.pullEvent()
- if sEvent == "modem_message" then return p1, p2, p3, p4, p5
- else return nil end
- end
- end
- function writeState(text, state, ifTrue, ifFalse)
- monitor.setTextColor(defColor)
- monitor.write(text .. ": ")
- if state then
- monitor.setTextColor(green)
- monitor.write(ifTrue)
- else
- monitor.setTextColor(red)
- monitor.write(ifFalse)
- end
- end
- function updateStatus ()
- monitor.setCursorPos(1,1)
- writeState("Farm", status.farm, "online ", "offline")
- monitor.setCursorPos(1,2)
- writeState("ME storage", status.ME , "online ", "offline")
- monitor.setCursorPos(1,3)
- writeState("Security", status.security , "online ", "offline")
- monitor.setCursorPos(1,4)
- writeState("Data storage", status.dataStorage, "online ", "offline")
- monitor.setCursorPos(1,5)
- writeState("Enigma", status.enigma, "online ", "offline")
- monitor.setCursorPos(1,6)
- writeState("Radar RAD2", status.RAD2, "online ", "offline")
- monitor.setCursorPos(1,7)
- writeState("GPS radar", status.GPSRadar , status.GPSRadarStat, "offline")
- end
- modemWire.open(basePort)
- local i = 1
- while true do
- i = 1
- while i < 7 do
- status[i] = false
- i = i + 1
- end
- i = 0
- while i < 60 do
- local p1, p2, p3, p4, p5 = recv(5)
- if p4 == "farm" then status.farm = true
- elseif p4 == "ME" then status.ME = true
- elseif p4 == "security" then status.security = true
- elseif p4 == "dataStorage" then status.dataStorage = true
- elseif p4 == "enigma" then status.enigma = true
- elseif p4 == "RAD-2" then status.RAD2 = true
- elseif p4 == "GPSRadar" then status.GPSRadar = true status.GPSRadarStat = "GPS radar"
- elseif p4 == "RAD-5" then status.GPSRadar = true status.GPSRadarStat = "RAD5"
- end
- i = i + 5
- end
- i = 0
- updateStatus()
- os.sleep(1)
- end
Add Comment
Please, Sign In to add comment