Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- send = 119
- receive = 121
- os.pullEvent = os.pullEventRaw
- local chat = peripheral.find("chat_box")
- chat.setName("DLA")
- chat.setDistance(math.huge)
- modem = peripheral.wrap("top")
- modem.open(receive)
- function say(text)
- chat.say(text)
- end
- function modemListen()
- while true do
- local _, _, _, _, text, _ = os.pullEvent("modem_message")
- if text == "update" then
- os.reboot()
- else
- say(text)
- end
- end
- end
- function chatListen()
- while true do
- _, _, username, text = os.pullEvent("chat_message")
- modem.transmit(send, receive, {username, text})
- end
- end
- parallel.waitForAll(chatListen, modemListen)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement