Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --I assume the modem is on the top
- local modem = peripheral.wrap("top")
- local channel = 1
- modem.open(channel)
- --Put your networking things here
- local newChannel = math.random(1, 65535)
- modem.transmit(actualChannel, actualChannel, "#/switch#")
- modem.transmit(actualChannel, actualChannel, tostring(newChannel))
- modem.close(actualChannel)
- modem.open(newChannel)
- local actualChannel = newChannel
- --On the receiving computer
- while true do
- local messageT = {os.pullEvent("modem_message")}
- if messageT[4] == "#/switch#" then
- local messageS = {os.pullEvent("modem_message")}
- local newChannel = tonumber(messageS[4])
- modem.close(actualChannel)
- modem.open(newChannel)
- actualChannel = newChannel
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement