Trying to gag several successive lines

KildClient forum.
Post Reply
Schmorgluck
Posts: 8
Joined: Fri Dec 12, 2014 2:43 pm

Trying to gag several successive lines

Post by Schmorgluck »

I've run into an issue in a MUD that has me spammed by unwanted messages. By the time this topic receives an answer the MUD's staff will most likely have solved the issue, but I ask anyway because I find it an interesting technical question.

I have already defined regular expressions for the first and last lines I want to gag but I don't know how to go about it because what happens in between can vary. I tried to devise something with triggers but I didn't find how to make it work, even by looking for inspiration in the channels plugin source code. I've looked into using and OnReceivedText hook but I didn't find a way to prevent the received text from being displayed if I don't want it to. If I may, the documentation about what hooks can do is a bit sketchy. Apparently $hookdata can't be modified or if it can, I have no idea how.

Any pointers about how to do something like that?

EDIT: I also tried combining a trigger that gags everything and an OnReceivedText hook that executes $world->echonlandlog(colorize($hookdata)) but it seems the trigger gags that too. Apparently triggers are executed before hooks? It seems to be confirmed as I also tried to set up a pair of hooks to enable and disable the general gag trigger but the first undesired lines were still displayed.
ekalin
Site Admin
Posts: 45
Joined: Sun Feb 05, 2012 3:59 pm

Re: Trying to gag several successive lines

Post by ekalin »

I don't think that hooks are the solution here.

I haven't test this, but I'd create three triggers:

- 1: for the first line, that gags it and enables trigger 3
- 2: for the last line, that gags it and disables trigger 3
- 3: matches anything ('.' as a regexp should be enough), gags the line, starts disabled
Post Reply