Skip to content

Text Substitution (sub and gag)

Avi Kelman edited this page May 28, 2017 · 3 revisions

(aard_text_substitution.xml)

Allows you to replace text with other text to leave yourself persistent notes or give your friends funny names.

How do I use it?

The plugin has built-in documentation covering several advanced features such as capture patterns and external script calls.

Type #sub help to display it.

Doesn't MUSHclient already have the ability to replace text with triggers?

Not like this. At least not without going to a hell of a lot of trouble, which is what this plugin does for you. Obviously anything that this plugin can do MUSHclient can also do, because the plugin is running in MUSHclient.

Can you give some examples of when and how you use it, for reference?

Example 1

Let's say I really dislike a player for some reason, but I hate using the game's ignore feature because I don't like completely hiding messages and it doesn't work on channel history anyway. So instead of hiding messages from that player, I would rather change their name to something really mean for a little private laugh.

I would do that with a command like this:

#sub {Lasher} {PoopFace} #nocase #alone

(This example is fictitious. I do not actually change Lasher's name to PoopFace.)

I use the #nocase option here to make sure that it works on all capitalizations of his name, but I also use the #alone option to make sure that it doesn't also catch other similar words like "slasher" or "flasher".

Example 2

I like to know when my name is mentioned, because it might mean that someone needs technical assistance. So this next #sub command will highlight my name in bright red any time it appears on the screen, for easy visibility. Now you might want to ask "But I saw on https://www.mushclient.com/forum/?id=8085 that you can do that with a basic color replacement trigger by choosing the 'highlight word' menu option. Why would you do it using this plugin instead?" The answer to that is covered in the last section on this page. For now, trust that I have a reason.

#sub {(Fiendish)} {@R%1$C} #nocase

I combine parentheses around my username with the #nocase option and %1 in the replacement field to tell the system in one line that I want it to work for all capitalizations of my name while preserving those capitalizations. It means I can be less specific in my replacement pattern and get the username highlighting effect effect without changing what it otherwise looks like and without needing to make dozens of different patterns for every possible combination of uppercase and lowercase lettering.

Color codes work just like they do on Aardwolf channels, so @R means switch to bright red, and $C resets the color back, so that only my name changes color and not also everything after it.

Example 3

I also like to leave myself notes about friends or other players. If I learn that a player is visually impaired, for example, I might leave myself a note about it to help me remember that I should try to avoid using unhelpful visual directions when giving tech assistance.

To accomplish that I can do:

#sub {PlayerName} {PlayerName (V.I.)}

Then every time PlayerName shows up on the screen it will be followed by a little reminder, making it look to me like PlayerName (V.I.).

Can't MUSHclient already omit lines from output and re-color words? Why do you use this plugin for those things too?

MUSHclient can do that for things in the main output, but it can't also do it for your plugins without some kind of coordination. Using this plugin's #gag and #sub commands even for the simple things that can be done somewhat easily already will make it so that other plugins can also cooperatively ask this plugin to filter their messages before displaying them. The Communication log window plugin, for example, uses this to also reflect the result of your #subs and #gags.

Clone this wiki locally