How to gag annoying players

Posted by Nick Gammon on Mon 05 Feb 2001 06:42 PM — 37 posts, 147,899 views.

Australia Forum Administrator #0
I get asked frequently how to "gag" players using MUSHclient.

You can do this easily using a trigger. Just match on what is needed to identify the annoying player, and check "omit from output". This will stop the matching line from appearing in your output window.

There are a few ways of matching on the name of the player(s) in question. A simple one is to simply specify the player name, like this:


Match on: Zayldan
Omit from output: checked
Regular expression: checked


This would match "Zayldan" anywhere in the line. The only disadvantage to this is that it would match on messages about Zayldan as well as from him.

A better way might be:


Match on: ^Zayldan (says|pages)
Omit from output: checked
Regular expression: checked


This would match on any line starting with Zayldan (that is what the "^" means), followed by "says" or "pages".

Gagging multiple players

To gag multiple players, you can use the "or" symbol in a regular expression. For example, to gag Zayldan, Vudric and Haoen, you could make this trigger:


Match on: ^(Zayldan|Vudric|Haoen) (says|pages)
Omit from output: checked
Regular expression: checked

Amended on Wed 20 Jun 2001 02:28 AM by Nick Gammon
#1
I like your method better than mine (currently I call /gag playername and it adds a trigger for them). What I'd like to know is if I can load trigger off a list stored in a variable somewhere?
Australia Forum Administrator #2
This is a pretty common request, so I've done a script for it (in VBscript). The Jscript one would look similar. :)

What it does is store a list of gagged players in a variable "gaglist", and when you add another it appends them to the end of it. The script then adds a trigger (replacing an existing one if necessary) to do the appropriate gagging.

To use this, add the script below to your script file, and then make an alias:

Alias: GAG *
Send: (nothing)
Label: gag
Script: OnGag





' --------------------------------------------
' Alias to gag players automatically
'
'  Call from the alias: GAG *
'
'   eg. GAG twerp
'
'  It maintains a list of gagged players in the
'   variable "gaglist" (which you can edit in the
'   world configuration screen if you need)
'
'  You may need to change the text of the trigger
'  match slightly. (eg. add "tells")
'
' --------------------------------------------

sub OnGag (thename, theoutput, thewildcards)
dim sName
dim sList
dim flags

sName = Trim (thewildcards (1))

' do nothing if no name
if sName = "" then exit sub

' get existing list
sList = world.GetVariable ("gaglist")

' if empty create new one, otherwise add to end
if IsEmpty (sList) then
  sList = sName
else
  slist = sList + "|" + sName
end if

' remember gag list for next time
world.SetVariable "gaglist", sList

' addtrigger flags
'    1 = enabled
'    2 = omit from log file
'    4 = omit from output
'   16 = ignore case
'   32 = regular expression
' 1024 = replace existing trigger of same name

flags = 1 + 2 + 4 + 16 + 32 + 1024

World.addtrigger "gag", "^(" + sList + ") (says|pages)", _
                 "", flags, -1, 0, "", ""

End Sub
#3
Umm I also have a question...
I play the mud Medievia in which we do trade runs as a way of making money. During trs you haul goods from one trade post to another over a long distance. Usually over long trs we use mounts to travel faster, ie: warhorse, morgans and so on.

Problem is that the mounts have annoying messages like:
A warhorse pants or A morgan collapses...
whenever we move too fast. So is there a way to gag this? At the moment I have to add a trigger for each line in order to gag them. I tried to use ^A morgan but that doesn't seem to work...
Australia Forum Administrator #4
A trigger like this should work:


A warhorse *


This is *not* a regular expression. To do the same thing using a regular expression you would use:


^A warhorse .*$





USA #5
Is there a way to gag everything or only up to a certain line? I mean it gags like 4 or 5 lines of text and everything else past that slips through.
Australia Forum Administrator #6
Probably the "everything else" is new lines - gagging gags the current line - in some cases a long line will wrap around so one logical line is 5 physical lines.

However the gagging gags the logical line, however long that is.

You could conceivably turn on another trigger (matching *) that would gag all lines, then you would need to detect when you needed to turn that trigger off, or you would not see anything else that session.
Canada #7
Is there a way to set yourself NOSPOOF, and gag someone based on their DB number? I'd also be interested to know if there's a way to remove a DB number from the output when you set yourself NOSPOOF.
Australia Forum Administrator #8
Gagging someone based on the DB number would be easy enough, you just need to modify the matching trigger appropriately. Paste an example line if you aren't sure.

As for dropping the DB numbers from the output that is a bit trickier. Triggers don't allow you to modify the text, however what you *can* do is omit the triggered text from output and then redisplay it, with parts missing. However the colour changes to the world note colour, not the original colour. This might not matter if most text is the same colour anyway, just make the note colour that colour.
Canada #9
What do I have the trigger match, exactly, to omit the DB?For instance, I'd like this:

[Someone(#666)] Someone pages: Test.

To turn to this:

Someone pages: Test.

I know I could enter each individual DB as a separate trigger, but that'd be just too much work. How would I go about setting a global trigger for all DBs exactly?
Australia Forum Administrator #10
I would have a trigger like this:

Trigger


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   match="[*(#*)] * pages: *"
   omit_from_output="y"
   script="OnPage"
   sequence="100"
  >
  </trigger>
</triggers>



In your script file put a sub like this:

Script


sub OnPage (name, line, wildcards)

  select case wildcards (2)

'
'  list the ones you want to suppress here
'
    case "666"
    case "777"
    case "888"

'
'  others will get echoed to the screen
'
    case else

      world.colournote "white", "black", _
             wildcards (3) & " pages: " & _
             wildcards (4)

  end select

end sub
Amended on Tue 23 Dec 2003 08:17 PM by Nick Gammon
Canada #11
I feel stupid. I couldn't make heads or tails of any of the example.
Australia Forum Administrator #12
  1. Copy the subroutine from this web page between the second set of lines above (script). Use the MUSHclient notepad or any text editor, such as the Windows Notepad. Paste in the subroutine into a new document. Save it as my_scripts.vbs in your MUSHclient directory.

  2. Go into scripts configuration and check 'enable script', and browse for the script file you just created. Like this:

    The script window will not look exactly like this, I took this image from an earlier screen shot.

    The other things you can leave as the defaults (World Open, World Connect etc. can all be blank).

    The script prefix is normally a slash, and is used to call scripts directly from the command area.

  3. Copy from this web page between the first set of lines above (trigger). Go to the trigger configuration screen in MUSHclient - the one with the list of triggers. The 'Paste' button will become active. Click it. That will paste in the trigger.
Now you should be ready to use it.
Amended on Tue 23 Dec 2003 08:16 PM by Nick Gammon
USA #13
How can I get my configurations window to look like this with tabs instead of the scroll bar on the left hand side?
Australia Forum Administrator #14
Go back about 20 versions. :)

I borrowed that configuration example from an earlier version.

The later ones have the scroll bar and the config screens grouped together into categories.

I normally check "auto-expand config screens" in the global configuration so that the individual configuration items are always visible - that will probably help.
Canada #15
Nick:

I've got an unusual variation on the gag problem. I need a trigger/gag that 'keys' on the character's name, but will truncate the pose/say after X characters.

Why a gag...?

I need to chop off mega-posers who are posting buffer-blowing poses (1024+) to annoy other users, and then going ~past~ that and then extending their poses by using the spoofs.

Why just a truncate, not an outright 'suppress'...?

I need to see short poses, as one person knows I put a supress/gag up, and therefore can't see their comments. They are using that to talk 'behind my back' and their talk amounts to character assassination. I need to see/log those to report them.

Why will a truncate work...?

A friend dupe'd me his log of one instance I caught by overheard comments from others. From what I'd missed, the 'comments' are short enough to be caught within a 400 char buffer (adjustable would be good)

No scripts please, I have trouble enough with simple expression use. If you can post ~exact~ format using my name, I'd be grateful (I'm a poor programmer) We can't trigger on DBref#, thats why I'm using char-names to trigger (Tapestries)

This is what I am using for a full gag/supress: (using my name to replace the 'target')

WhiteWolf*
- Ignore Case, Keep Evaluating, & Omit from Output are set.
- covers say/pose/OOC comments.

* ) [ WhiteWolf ]
- Ignore Case, Keep Evaluating, & Omit from Output are set.
- this trigger'd on the spoof id area at end of spoofs (had to get the exact format/spacing)

And with permission, I'd like to post the 'format' to Tapestries Forum so others can use it (its a growing problem)

WhiteWolf
USA #16
can you gag the long lines? Or do you want anything longer to be truncated? I suppose itd be easy enough to trigger the long lines
a Regexp:
^[name and other stuff].{##1,##2}$
^ - start of a line
name - their name, plus any other formatting things.
. - regexp for 'any' character
##1 - Lower bound for the ammount of '.' (see above)
##2 - upper bound.
$ - End of a line

So, if you wanted to match on anything longer than say... 100 extra chars, but shorter than 200 (this is in addition to the name, etc, to figure your real length, just subtract)
you would have:

^Bob.{100,200}$
that would match on something that has Bob (yes it is K sens) and then 100-200 character after that.

you could use this to match on lines of length XX to YY (to remove a bound, simply dont put a number {,XX2} or {XX1,}.

If you wanted to remove the long lines completely, you could match, and then simply gag (perhaps write to a log file, or whatever, for later review).
If you wanted to truncate and still display, gag and then tell it back to the mud (youll lose color info, and the like). You COULD even truncate it with a regexp, rather than scripting.
^([name, etc])(.{100,200}).*$
and then you wouldnt need to truncate, as the .{100,200} would be a variable, with a certain length, and then the .* would be everything after that. Then youd just use the .{100,200} for your worldtell.

That last bit wasnt nessisarily supposed to make sense to you Whitewolf, just the next forum member who comes and actually writes a real trigger with a simple script. Im sure if I attempted it at 415am, it would cause more problems than its worth.
Australia Forum Administrator #17
What you need is a small script file, like this:



sub OnGagTrigger (name, line, wildcards)
  ColourNote "white", "black", Left (line, 400)
end sub



Just those 3 lines, put into a file with notepad, and call it, say, "gag.vbs".

The "400" there is the number of characters that will be retained. The colours are the colour the line will be displayed, you can adjust those. Use the MUSHclient colour picker (Edit -> Colour Picker) to choose the names or codes for any other colours (eg. mistyrose on tomato).

Enable scripting in the script configuration tab, and browse for the script file above (gag.vbs). Language: VBscript.

Then paste this trigger in:


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="WhiteWolf"
   omit_from_output="y"
   regexp="y"
   script="OnGagTrigger"
   sequence="100"
  >
  </trigger>
</triggers>


This matches any line with WhiteWolf on it anywhere, omits it from the output, and then calls the script, which redisplays the first 400 characters.
Amended on Sun 11 Apr 2004 11:22 PM by Nick Gammon
Canada #18
Uh, Nick... I said I aint a programmer.

Managed the gag.vbs file (placed in the scripts directory)

Found the Scripting Window, and got the 'enable' box toggled. That the only one I need to toggle?

From there I got confused, as I couldn't see where that second 'script' seemed to fit... but I realised it was just toggles for the Trigger window, as I'm using 3.42 (soon to be upgraded) and that must have been from an ancient version. There is no place to paste that in.

I've tested it, and it works perfectly. Now I just gotta adjust the colors (I use a white background...)

Thanks Nick.

One last Q:

OnGagTrigger is just the subroutine name, right? (starting to remember his Basic programming from HS) I could put any name in there? I've seen a few other possibilities for this... (making 200/300/400/etc. length ones)

And can I put all the subroutines in that selfsame 'gag.vbs' script? (thinking he's missed the possibilities of this client for too long)


-thinking he needs to go back & relearn some of this...

WhiteWolf
Amended on Mon 12 Apr 2004 05:54 AM by WhiteWolf
Australia Forum Administrator #19
Since you said you aren't a programmer I guessed you didn't already have a script file. Use the "Browse" button in the script configuration window to select your gag.vbs file, instead of any file that might already be listed there.

Quote:

OnGagTrigger is just the subroutine name, right? (starting to remember his Basic programming from HS) I could put any name in there?


Yes, any name, however it must agree between the script file and the trigger. Notice it appears in both places:


sub OnGagTrigger (name, line, wildcards)
  ColourNote "white", "black", Left (line, 400)
end sub


... and in the trigger ...


script="OnGagTrigger"



Australia Forum Administrator #20
Quote:

And can I put all the subroutines in that selfsame 'gag.vbs' script? (thinking he's missed the possibilities of this client for too long)


All the subroutines? How many do you have? The one I mentioned is the only one you need. However yes, if you are doing variations, they also go in that file.
USA #21
Nick, why bother with a script file when it can be done in a regexp? Its cleaner, (and possibly faster?).
Canada #22
Mebbe I can answer that... even if I'm guessing.

I found the RegEx couldn't do a successful truncate AND do a color-flag at the same time, but the script can, as the trigger ~finds~ the target, but the sub does the truncate & color-flag. Don't ask me why...

I find flagging people I should ignore/avoid as grey on white helpful, just as I color-flag my pages & whispers, and a bunch of other items. I still haven't gotten the bugs out of the pages and whispers, as I need a generic 'name/word' wildcard.

As for Nick's question about 'all I need', I found I can 'clip' some of the annoying poses shorter than others, so could use a few 'clippers' with variable 'clip-buffer' lengths.

Yes, I could probably modify the existing sub a bit and do that, but lemme learn that slowly, 'k? Easier at this point to have a few very short 'clipper' subs.

Soon as I can scrape it up, I think I'm gonna get a reg key, as now that I've seen the ~distinct~ advantages (and the help) that 'support' offers for this client.

WhiteWolf
Australia Forum Administrator #23
Quote:

Nick, why bother with a script file when it can be done in a regexp? Its cleaner, (and possibly faster?).


Er, using my approach of truncating in the script I needed to have it in a script file, however this trigger here will do it without scripting ...


<triggers>
  <trigger
   custom_colour="2"
   enabled="y"
   ignore_case="y"
   keep_evaluating="y"
   match="^(.*WhiteWolf.{1,200})"
   omit_from_output="y"
   regexp="y"
   send_to="2"
   sequence="100"
  >
  <send>%1</send>
  </trigger>
</triggers>


What this does is match anything (any number of characters) before the word WhiteWolf, and then the first 200 characters *after* WhiteWolf, omits the line from output, and then sends to Output (the truncated bit).

So yes, this will do it without scripting.

The echoed line will be in the world.note colour, however you can change that in the scripting configuration tab.

Canada #24
Nick, got another problem now.

My clipper-trigger hiccups every so often, and begin double-displaying the 'clipped' lines as two separate poses. I checked the trigger and the script subroutine, no changes.

When I turn the trigger off, the problem vanishes, so I know its trigger/sub related. Yes, the Omit From Output box is ticked.

Wait... should this be set 'Send To: Output', not 'send to World'? (all my triggers are set 'Send To: World'


And on the non-script Trigger:

match="^(.*WhiteWolf.{1,200})"

- nope, won't work, has to match name at beginning of line.

enabled="y"
custom_colour="2" (or whatever color I choose)
ignore_case="y"
keep_evaluating="y"
omit_from_output="y"
regexp="y"

- these are already set for the other scripted format.

send_to="2"

- no numbers, what does 2 relate to? Send To: Output?

sequence="100"

- I use another #...

<send>%1</send>

- totally lost here...


WhiteWolf
(using MushClient 3.47, wondering if it was 'recalled' as 3.45 is now back up...)
Amended on Sun 02 May 2004 02:39 AM by WhiteWolf
USA #25
Umm, Im not sure what youre asking exactly, but Ill go through your individual questions.
Yes, it should be send to output.
You SHOULD be able to copy/paste the trigger into MC to not have to worry about what each thing means, but here goes:


First one, If you want that trigger to match at the beginning of the line, remove the .* at the beginning. So, It'd be:
^(WhiteWolf.{1,2000})

Send to: 2
Yes, two is output. The number correlates to the position it is in the send to list (0 is the first).

Sequence: Triggers are evaluated in the order of their sequence. Lower numbers are evaluated before higher numbers. This is useful for having one trigger stop other triggers from firing.

the send thing, the <send></send> just delimits the stuff it sends. The %1 is the first wildcard of your match. (wildcards are surrounded by parenthesis, so in this case, its your whole trigger), %2 is the second, and so on. I believe you can have 999 wildcards now? It used to be 9.
Also, %0 is the WHOLE matching line.
Canada #26
Thanks Flannel

Ok, that cleared a lot of it up, but I still don't see where the (send) %1 (/send) goes. It almost looks like HTML coding to me, and I dunno much HTML!

From Nick's formatting, it's still buried within the main Trigger edit/add window layout, but I cannot find a corresponding box... OH.

There are the three windows at the top:

Trigger: (where ya put the trigger sequence/expression)
Match: (not exactly sure what this does...)
Send: (put that HTML-like bit in here?)

WhiteWolf
(slowly catching on... I think)
USA #27
you JUST put the %1
the <send></send> isnt HTML, its XML, world files, and plugins are stored in it, it makes things easy.

The Match is for color matching (color) on (color).

you CAN just copy this:

<triggers>
<trigger
custom_colour="2"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^(.*WhiteWolf.{1,200})"
omit_from_output="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>%1</send>
</trigger>
</triggers>

all of that, from <triggers> to </triggers> and then go to the trigger page, and click paste. Itll add the trigger, just the same as adding it all by hand. Thats the beauty of the XML system.
This picture illustrates the paste button. (Yes, it is an alias, but Nick doesnt have one for a trigger)
http://www.gammon.com.au/images/alias_paste.gif
Amended on Sun 02 May 2004 07:57 AM by Flannel
Canada #28
Ah... no-one told me that either.

Now the wierd format makes sense.

Oh: Is there a limit to the amount of triggers?

I ask as many are of the same type, just different names, and could be compiled with (name1|name2|name3|etc) right?

WhiteWolf
(his newbie beanie showing despite 3 years of use)
USA #29
No, there is no limit, well, your computers memory.

As for multiple triggers, If you mean can you paste multiple triggers with the | in between names, no.

Although, you can just have the matches be (X|Y|Z) (matches X, or Y, or Z)(regexp).

you could also do something like this:

<triggers>
<trigger
custom_colour="2"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^(.*WhiteWolf.{1,200})"
omit_from_output="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>%1</send>
</trigger>

***Copy From here***
<trigger
custom_colour="2"
enabled="y"
ignore_case="y"
keep_evaluating="y"
match="^(.*Flannel.{1,200})"
omit_from_output="y"
regexp="y"
send_to="2"
sequence="100"
>
<send>%1</send>
</trigger>
*** to here ***
</triggers>

You can just open a text file, paste out as many as you need (between <trigger and </trigger>, and edit them there, then copy the whole thing (<triggers> to </triggers>), and paste them.
Australia Forum Administrator #30
This gets asked so often I have now made a wiki page explaining pasting triggers which deals with exactly how to do this, with screen dumps.
Canada #31
Ok, before I go altering the trigger yet again...

Putting %1 in the 'Send' area, & in the Send To: area 'Output' does ~not~ solve my double-iteration problem.

I'm beginning to think its a trigger conflict, but I don't see how, as they are exclusive (one triggers on name at beginning of pose, other on name appended to end of a spoof)

I found the problem... both the above, despite supposedly being exclusive when set at the same sequence were both going off. There is ~no~ way it can match on both unless the person was manually appending a fake spoof tag on the end)

I reset the sequence, and its gone... *sigh* mapping sequences is gonna become a pain...


As for the Wiki-paste instructions, when I go to that main triggers window, my 'Paste' button is ~not~ lit, so I cannot paste, hence I have to do it all ~manually~.

Again, is this a 3.47 bug/flaw?

WhiteWolf (rather PO'd)
Amended on Tue 04 May 2004 02:38 AM by WhiteWolf
Canada #32
ERF... formatting... Now I see how the client could misunderstand me. Its been way too long since I took Comp-Sci/Programming in college.

I understood the following line as a single 'phrase' to be matched, and I suspect MC dinna. What do I need to do to make the it one 'match-item'?

* ) [ Sample-Name ]

(thats what I had in the window, though name-edited)

Do I have to put another set of braces around it to make it one 'match-item'? Those brackets have to be used as they are the ones used by the mu*'s spoof-identifier. Its tacked onto the end of the spoof, with exactly that spacing too...

(thinking he could use a manual on 'How to Code Triggers')

WhiteWolf
Australia Forum Administrator #33
Quote:

As for the Wiki-paste instructions, when I go to that main triggers window, my 'Paste' button is ~not~ lit, so I cannot paste, hence I have to do it all ~manually~.


You shouldn't have to do that manually, let's get that straight. If you copy from, and including <triggers> to </triggers> in a proper example and go to the trigger list and paste it, it *will* work. However copying from <trigger ... to </trigger> will not work. You need the <triggers> part. It looks for that before it enables the paste button.

I'm losing track here of what triggers you have, what text you are matching on, and what is the exact problem. Perhaps *you* copy the trigger/s you are using, the text you are matching on, and explain what is wrong. That way we can see exactly what you have.

Quote:

I understood the following line as a single 'phrase' to be matched, and I suspect MC dinna. What do I need to do to make the it one 'match-item'?

* ) [ Sample-Name ]


Again, I would like to see exactly what you have. Is this a regular expression or not? It is important. If not, you don't throw in extra brackets or it will try to match the brackets. If it is, it won't match. For instance, in a regular expression this:

[Nick]

doesn't match "Nick" in square brackets, it matches a *single* character which is one of the following: N, i, c, k.



Amended on Tue 04 May 2004 09:55 PM by Nick Gammon
Canada #34
Thanks again Nick.

I see why I couldn't paste Flannel's 'corrected' trigger format (after I mentioned it had to be the beginning of the pose) The <triggers> & </triggers> was outside the noted 'copy' area, and that blocked my attempts.

Lemme dig thru my .mct file here, and get the two triggers...

</trigger>
<trigger
custom_colour="5"
enabled="y"
group="Pose_Clipper"
ignore_case="y"
keep_evaluating="y"
match="^Sample*"
name="Sample"
omit_from_output="y"
regexp="y"
sequence="92"
>
</trigger>

</trigger>
<trigger
custom_colour="5"
enabled="y"
group="Spoof-Gag"
ignore_case="y"
keep_evaluating="y"
match="* ) [ Sample ]"
name="Sample_2"
omit_from_output="y"
sequence="94"
>
</trigger>

Now I solved my problem by giving the first one sequence priority, but #2 should not interfere... what do I need to put around that text-sequence to have it interpreted as a whole, not as individual items?

WhiteWolf
USA #35
that copy area was to duplicate the trigger X times. If you wanted three triggers, copy that, then paste it inside the <triggers> </triggers> once. If you read the instructions at the end, I thought I made it clear.

As you were trying to add trigger en mass.
Australia Forum Administrator #36
Quote:

Lemme dig thru my .mct file here, and get the two triggers...


You don't need to dig in the .mct file, although that will work. Just look at the triggers list, select the two triggers (Ctrl+Click to select discontiguous ones) and then hit the "copy" button. That will do the same thing without having to wade through the world file.

In fact, I had to juggle what you had by adding <triggers> and </triggers> to it, and removing an extra </trigger> in the middle. So it would have been simpler to just do what I suggested above.

Now, back to solving your problem.

Your first trigger isn't going to do much. It matches:

^Sample*

Being a regular expression that means matching a line starting with "Sampl" and followed by zero or more of the letter "e". ie.

Sampl
Sample
Samplee
Sampleee (and so on).

I would drop the asterisk, and match on "^Sample". That will match any line starting with "Sample".

The second one, which is not a regular expression will match on:

<anything> ) [ Sample ]

However it has to literally get that exact construction (including the spaces, brackets etc.).

Now if you posted some example lines which are what you are trying to gag, it would help.