Hey guys, bit newbie at Computer craft still and I decided why not work on a complex topic like make a Server chat.
I have a little down set but what I really need to know is it possible when a computer receives a message to see what ID it has came from, and act accordingly a very budget program would be
if ID = 1 then
send back hi
if ID = 2 then
don't send back anything since it came from here.
Excuse the no syntax no nothing, I just want to know if this is possilble.
I hope you understand if not I can write up what I have so far.
How to find out an ID from a message (Rednet)
Started by Johnathon, Apr 11 2013 03:46 AM
3 replies to this topic
#1
Posted 11 April 2013 - 03:46 AM
#2
Posted 11 April 2013 - 03:48 AM
id, message, distance = rednet.receive()
rednet.receive() returns three values: the ID of the computer that sent the message, the message itself, and the distance to the transmitting computer. If you only want to store the ID and the message, then you can just do:
id, message = rednet.receive()
rednet.receive() returns three values: the ID of the computer that sent the message, the message itself, and the distance to the transmitting computer. If you only want to store the ID and the message, then you can just do:
id, message = rednet.receive()
#3
Posted 11 April 2013 - 03:50 AM
TheCoryKid, on 11 April 2013 - 03:48 AM, said:
id, message, distance = rednet.receive()
rednet.receive() returns three values: the id of the computer that sent the message, the message itself, and the distance to the transmitting computer.
rednet.receive() returns three values: the id of the computer that sent the message, the message itself, and the distance to the transmitting computer.
You just saved me so much research
How can I use the "ID" switch to calculate the reply.
Would i go like
if (rednet,receivve().ID == 1) or something similar?
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











