Author Topic: Muting messages  (Read 3340 times)

0 Members and 1 Guest are viewing this topic.

KoRo

  • Fat, Emo Robot
  • Centurian Lord
  • ********
  • Posts: 3,437
  • Reputation: +14/-6
Muting messages
« on: March 20, 2014 08:10 pm CDT »
I'm curious about how certain people have been able to "mute" messages in the message window, either by a script intentionally written to filter out the clutter, or when one is issuing commands such as #w or !rpg (Taurik's script pack). I spent the last hour scouring through various scripts but I haven't found any line that mentions redirecting the text so that it doesn't appear in the message window.

Anyone have any info on this? Thanks

Bovidi

  • Undead Hero
  • ****
  • Posts: 216
  • Reputation: +1/-0
    • http://www.geocities.com/mygamepage101/orc
Re: Muting messages
« Reply #1 on: March 21, 2014 12:30 am CDT »
There are a few differences.

#w is filtered out by the server.  Using the function remotesay(....) to be more precise.  remoteSay usually then sends the commands to the client to say what you want to say.

For taurik's script like !rpg it gets a bit more complicated.  If you don't have presto then do this.  If you want to block a message coming in from the server you would use this function *usually found in client...so anything executed by autoexec should override it*
   function onClientMessage(%clientId, %msg)
   {
       if(String::findsubstr(%msg, "ignore") != -1)
         return false; //Message blocked (if the word ignore is found)
      return true;
   }

For presto you would do something like this
Event::Attach(eventClientMessage, NewonClientMessage);
function NewonClientMessage(%clientId, %msg)
{
       if(String::findsubstr(%msg, "ignore") != -1)
         return false; //Not entirely sure this works the same in presto
      return true;
}


To block a message before you say it use function
function say(%channel, %message)
{
//%channel is 0, or 1 if I remember correctly...0 being say and 1 being team?  not sure which.
//If you return before calling the remoteeval the server will not see the message
remoteEval(2048, say, %channel, %message);
}

I am not sure if presto has an attachment event on this....it is up to you to look through it if you do....I hate presto

KoRo

  • Fat, Emo Robot
  • Centurian Lord
  • ********
  • Posts: 3,437
  • Reputation: +14/-6
Re: Muting messages
« Reply #2 on: March 21, 2014 05:52 pm CDT »
I've noticed a lot of people hold Presto in low esteem. I'm a really big fan of the event::attach() function as well as schedule::add(). That's all I use presto for, though. If you happen to know of some easy workarounds for these, I'll gladly get rid of Presto. It's very cluttery.

Regarding your first example, how does onClientMessage() act without the message first appearing in the message window? Does it act between the server and your window, sort of like a filter, depending on whether it returns true; or false;?
« Last Edit: March 21, 2014 05:58 pm CDT by KoRo »

Bovidi

  • Undead Hero
  • ****
  • Posts: 216
  • Reputation: +1/-0
    • http://www.geocities.com/mygamepage101/orc
Re: Muting messages
« Reply #3 on: March 22, 2014 01:48 pm CDT »
Well a pseudo code of how the tribes messaging would work

get incoming message from server
call tribes onClientmessage function and save return
if return was true
internal tribes show message
if false
don't do the internal stuff

Similar thing with say...it just blocks the sending of it to server.


As for presto, there is something similar to event::attach built by nofix....one of his plugins...I'll post a link later if I find it again