Skip to content

Instantly share code, notes, and snippets.

@drucifer-sc
Created August 14, 2025 10:28
Show Gist options
  • Select an option

  • Save drucifer-sc/0edc937d8daeb7b68d6fb23e14f7c8ff to your computer and use it in GitHub Desktop.

Select an option

Save drucifer-sc/0edc937d8daeb7b68d6fb23e14f7c8ff to your computer and use it in GitHub Desktop.
An example script showing basic how to send/receive discovery messages.
--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