_radiocomm
Value Type
| numeric, array |
Descriptions
An array that contains messages sent by other robots using the radiosend command. The array contains messages received on both the public and team tuners. See the radiochannel topic for more information about radio tuners.
The _radiocomm variable uses both array and property elements to describing messages. Before reading about the structure of the _radicomm variable you should be familiar with the workings of arrays and properties. See the user variables topic for more information.
The root value of _radiocomm contains the number of messages stored in the array component of _radiocomm. Each array element of _radiocomm contains one message sent by another robot along with information about that message. This is the format of the _radiocomm variable:
| Variable | Description |
| _radiocomm | Number of elements in array (number of messages) |
| _radiocomm[n] | Channel number the message was sent on |
| _radiocomm[n]._msg | Deep copy of the received message |
| _radiocomm[n]._bearing | Bearing to the sender when the message was received |
Where n is an index to each message ranging from 0 to (_radiocomm-1) inclusive.
Array element _radiocomm[0] contains the oldest message while _radiocomm[_radiocomm-1] contains the most recent message. The _radiocomm array can receive and hold any number of messages sent by other robots. When a robot's turn completes, however, the _radiocomm array is automatically cleared if it contains more than 25 messages. This prevents robots that never process incoming messages from wasting resources. Robots may also manually clear the _radiocomm array at any time using the clear command.
Since the _radiocomm[n]._msg property is a deep copy of the variable passed to the radiosend command, it may have array and property elements itself. Generally robots sending messages to each other must agree on the format they will use for messages. If a message that was sent by a member of another team is received on channels 1 through 9 the contents of _radiocomm[n]._msg will be encoded. Encoded messages have the value 999999. The _radiocomm[n]._bearing property is always valid, however, even for encoded messages.
See the help topics for radiosend and radiochannel for more information about radio channels. See the fire.prg and side.prg robots for an example of radio communications.
See Also