Created
August 14, 2025 10:28
-
-
Save drucifer-sc/0edc937d8daeb7b68d6fb23e14f7c8ff to your computer and use it in GitHub Desktop.
An example script showing basic how to send/receive discovery messages.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --PASC Discovery tool | |
| --Drucifer | |
| local find,pullEvent,serialize=_G.peripheral.find,_G.os.pullEvent,_G.textutils.serialize | |
| local modem=find("modem",function(n,v)return v.isWireless()end) | |
| repeat | |
| modem.open(759) | |
| until modem.isOpen(759) | |
| modem.transmit(759,759,{protocol="PASC",type="discovery"}) | |
| local lastreceived=os.epoch("utc") | |
| while true do | |
| local receive={pullEvent()} | |
| if receive[1]=="modem_message" and receive[3]==759 and receive[4]==759 and receive[5].type=="discovery_response" then print(serialize(receive[5])) lastreceived=os.epoch("utc") end | |
| if os.epoch("utc")>lastreceived+1000 then break end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment