Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local args = {...}
- local modem = peripheral.find("modem")
- if not modem then print("Modem needed, please attach one") return end
- local startchannel = 1
- local endchannel = 128
- if args[1] and args[2] then
- if args[2]-args[1] > 128 then
- print("Too many channels, applied default.")
- else
- startchannel = args[1]
- endchannel = args[2]
- end
- end
- for i=1,128 do
- modem.open(i)
- end
- print("Listening on channels",startchannel.."-"..endchannel)
- while true do
- local ev,side,channel,rpchannel,msg,distance = os.pullEvent("modem_message")
- print("Frequency:",channel)
- if message then
- if message.Reason ~= nil then
- print("R:",message.Reason)
- end
- if message.Pos ~= nil then
- print("Pos:",message.Pos)
- end
- if message.Content ~= nil then
- print("Content:",message.Content)
- end
- if not message.Content and not message.Pos and not message.Reason then
- print(message)
- end
- end
- end
Add Comment
Please, Sign In to add comment