Posted 15 December 2015 - 03:54 AM
ok so… ive been making a computercraft msging system. Everythings running as expected but theres one thing that i cant seems to fix.
So heres a small example:
1. function msgSend()
2. msg = io.read()
3. rednet.send(id,msg)
4. end
5.
6. function msgReceive()
7. id, msg = rednet.receive()
8. print(">:", msg)
9. end
10.
11. function sendAndReceiveMsges()
12. parrallel.waitForAny(msgSend, msgReceive)
13. end
14.
15. while true do
16. sendAndReceiveMsges()
17. end
the problem i have is when computer[1] is typing and computer[2] and sends a msg *BEFORE* computer[1] finishes typing its msg,
computer[1] will receive the msg and stop the typing, so pretty much the (rednet.receive()"–line 7") stops the (msg = io.read()"–line 2")
anyone know any fixes?
So heres a small example:
1. function msgSend()
2. msg = io.read()
3. rednet.send(id,msg)
4. end
5.
6. function msgReceive()
7. id, msg = rednet.receive()
8. print(">:", msg)
9. end
10.
11. function sendAndReceiveMsges()
12. parrallel.waitForAny(msgSend, msgReceive)
13. end
14.
15. while true do
16. sendAndReceiveMsges()
17. end
the problem i have is when computer[1] is typing and computer[2] and sends a msg *BEFORE* computer[1] finishes typing its msg,
computer[1] will receive the msg and stop the typing, so pretty much the (rednet.receive()"–line 7") stops the (msg = io.read()"–line 2")
anyone know any fixes?
Edited on 15 December 2015 - 08:44 AM