Программа для обмена сообщениями между двумя компьютерами
write("ICQ 1.0 ") print("Developer - Aleksey2093") print("Your ID is: ", os.getComputerID()) print("Please, enter you modem side") write("Side: ") side = read() print("Enter your friend ID") write("ID: ") id = read() id = id + 0 rednet.open(side) print("OK") sleep(1) term.clear() term.setCursorPos(1,6) local function send() term.clearLine() write("Message: ") msg = read() rednet.send(id,msg) term.setCursorPos(1,17) term.clearLine() print("You: ", msg) term.clearLine() end local function com() term.setCursorPos(1,19) term.clearLine() write("Command: ") cmd = read() if cmd == "send" then send() com() else if cmd == "exit" then term.clear() os.run({}, "rom/programs/shell") else term.setCursorPos(1,17) print("Unknow command") print() term.clearLine() com()
end end end local function check() id, me = rednet.receive() term.setCursorPos(1,17) term.clearLine() print("Friend: ", me) print() check() end parallel.waitForAny(check, com)