When clients receive messages from the server, the message is automatically sent with a callback, so the client can perform certain commands when they get the message.
You can send the callback using the
messageAll() or
messageClient() commands.
The format is:
messageAll('callback',"msg");OR
messageClient(client,'callback',"msg");If you make the message a tagged string, you can input variables into the string.
For example:
messageClient(%client,'msgClientJoin','%1 has entered the game.',%newPlayer.name);Before a client can utilize the callback, they have to add it by doing:
addMessageCallback( [tagged callback name] , [command] );For example:
addMessageCallback('msgCreateGuild',"handleNewGuild");
function handleNewGuild(%callback,%guildName)
{
//add the guild (%guildName) to a list?
}
So then, you could do:
messageAll('msgCreateGuild','%1 has created a new guild: %2.',%client.name,%newguild);
Note that in your client function for the message callback, it automatically inputs the arguments from the messageAll() or messageClient() command. The first argument is always the message callback name.