mplay_message_id()

This function is used in conjunction of mplay_message_receive(), this functions returns the id of the last message received, with this information you can determine what to do with message, for e.g. either updating a coordinate or receiving a chat string.

 

Example

if (mplay_message_receive(0)) //observe the use of this function

{

switch (mplay_message_id()) //switch the id of the message

{

  case 1: //something

  break;

  case 2: //something

  break;

   //...

}

}

 

You can see in the above example how we test if it can receive a message, because mplay_message_receive returns if there was a message. If there’s a new message we use a switch statement to take proper action based on what mplay_message_id returns.  Sometimes you need to know also the name of the player who sent the message, useful for chat programs, and also the value of the message.

 

gml_josea Revision #1