Author Topic: messageAllExcept  (Read 1168 times)

messageAllExcept();

What parameters are used in this function?

Code: [Select]
messageAllExcept(%exceptantClient,%type,%message);

// Variables:
//    %exceptantClient is the client you are NOT messaging
//    %type should be two single quotes (null) unless you are using MsgAdminForce, MsgClientJoin, etc.
//    ^ If you don't know if you need to use them, don't use them. You will know if you need to use them, really.
//    %message is simply the message you are sending

// Examples:
//    messageAllExcept(findClientByName("Truce"),'',"\c6Truce is a \c0cigarette\c6.");
//    ^ Basically this would be talking behind my back ;P
//    messageAllExcept(findClientByName("Kalphiter"),'MsgClientJoin',"\c1Kalphiter2 has connected.","Kalphiter2",999999,1337,0,0,1,1);
//    ^ Adds "Kalphiter2" to everyones NPL_List but yours. Displays message for realism and sets their BLID to 1337.

I don't think this is used very much anymore, if at all.
My script searcher couldn't find it in any of the add-ons I have.
« Last Edit: December 30, 2008, 09:58:33 PM by Truce »

I remember MessageAllExcept had a 'team' parameter at some point, but actually changing %client.team totally breaks their chat in minigames and stuff. (See: Team DM v1-3)

Torque Game Builder function definition (it's in the code), I'm sure it's the same for Blockland and usual Torque Game Engine
Code: [Select]
function messageAllExcept(%client, %team, %msgtype, %msgString)
{
   // To ignore %client or %team, pass in -1 for it.
   %count = ClientGroup.getCount();
   for(%i = 0; %i < %count; %i++)
   {
      %recipient = ClientGroup.getObject(%i);
      if((%recipient != %client) && (%recipient.team != %team))
         messageClient(%recipient, %msgType, %msgString);
   }
}

Effectively, it's just as efficient to loop through ClientGroup, ignoring the specific person/people you want, and using messageClient. This also allows you to add more flexibility (e.g. only certain minigames, only certain status)

Ah, I missed seeing the -1 in this post:
http://forum.blockland.us/index.php?topic=46683.msg737527#msg737527

Thats the only place I've seen this function (besides this topic, of course).