SHOW:
|
|
- or go back to the newest paste.
| 1 | CID=os.getComputerID() | |
| 2 | msg=CID..", "..os.getComputerLabel() | |
| 3 | ||
| 4 | modem = peripheral.find("modem")
| |
| 5 | if not modem then | |
| 6 | - | id, message = rednet.receive() |
| 6 | + | print("modem not found")
|
| 7 | return | |
| 8 | end | |
| 9 | modemside = peripheral.getName(modem) | |
| 10 | rednet.open(modemside) | |
| 11 | ||
| 12 | while true do | |
| 13 | id, receive, protocol = rednet.receive() | |
| 14 | message = receive:lower() | |
| 15 | words = { ... }
| |
| 16 | for word in message:gmatch("%S+") do
| |
| 17 | table.insert(words, word) | |
| 18 | end | |
| 19 | if words[1] == "teleport" then | |
| 20 | print(id..", "..message) | |
| 21 | shell.run(message) | |
| 22 | elseif words[1] == "get" then | |
| 23 | print(id..", "..message) | |
| 24 | if #words < 2 then | |
| 25 | print("missing arguments")
| |
| 26 | return | |
| 27 | end | |
| 28 | if words[2] == "teleporter" then | |
| 29 | print("sending teleporter name..")
| |
| 30 | rednet.send(id,msg,protocol) | |
| 31 | end | |
| 32 | end | |
| 33 | end | |
| 34 | print("programm end")
| |
| 35 |