mplay_message_send(player,id,val)

player = the target player to send the message, you can use either it’s string identifier or it’s number identifier. remember the player functions described before. Use 0 to send the message to everyone.

id = the id number for the message, it can be any real number.

val = the data to be sent within the message.

 

This functions is like a box you’re going to send to someone. You put something in the box, you specify who is going to receive the box and send it. The messages sent are going to go to a queue of the target player, meaning the messages are treated as first in first out (FIFO), the first message receive by the player will be the first message it will dispatch.

 

Example

//key press event

x+=4

mplay_message_send(0,011,x)

//Send a message to everyone, containing the current x, with the id 011

//Is a good idea to make the ids have a meaning, I usually use Ids like:

//011: 0--a nice number, 1--the player who's sending the message

//1--a sub-id number that represents to me x

 

Now you know how to send messages, then you need to learn how to handle them in the other side.

 

gml_josea Revision #1