Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local modem = peripheral.find("modem")
- if not modem then print("Modem required, preferably an ender one") return end
- modem.open(99)
- term.clear()
- term.setCursorPos(1,1)
- local monitor = peripheral.wrap("top")
- monitor.setTextScale(0.5)
- print("Open and listening for logs on channel 99")
- while true do
- local ev,side,channel,repchannel,msg,distance = os.pullEvent()
- if ev == "modem_message" and distance ~= 0 then
- print("Frequency:",channel)
- if msg.Title and msg.Body then
- local severity = 1
- if msg.Severity then
- severity = msg.Severity
- end
- if term.isColor() then
- local colours = {
- [1] = colors.white,
- [2] = colors.orange,
- [3] = colors.red
- }
- term.setTextColor(colours[severity])
- end
- print(msg.Title..":",msg.Body)
- term.setTextColor(colors.white)
- end
- if not msg.Body and not msg.Title then
- print("Invalid Indexes On Message")
- end
- elseif ev == "redstone" then
- redstone.setOutput("left",redstone.getInput("right"))
- if redstone.getInput("right") then
- modem.transmit(99,99,{Title="Tornado",Body="Tornado started at Home Base"})
- else
- modem.transmit(99,99,{Title="Tornado",Body="Tornado ended at Home Base"})
- end
- end
- end
Add Comment
Please, Sign In to add comment