Writing Triggers - fiendish/aardwolfclientpackage GitHub Wiki
Scripting is a complicated subject that has been addressed by documentation for MUSHclient itself. See the following pages for some help on writing triggers:
- MUSHclient documentation: triggers
- Introduction to scripting
- Making a simple trigger
- Making a script to count mobs killed
- Video showing how to make a trigger
- Scripting function list
- Complete online documentation for MUSHclient
I tried making a trigger but it isn't firing. What did I do wrong?
In zMUD, if you make a pattern that looks like
This is a pattern
It will match on
HELLO This is a pattern FROM THE FUTURE!!!
Because zMUD's standard pattern format implicitly allows anything at the start and end.
MUSHclient works differently. MUSHclient's standard pattern format has no implicit allowance for extra garbage outside of the pattern. In MUSHclient if you want to catch
HELLO This is a pattern FROM THE FUTURE
and also just
This is a pattern
Then you would need to make your pattern something like
*This is a pattern*
Or switch to using regular expressions, which are much more expressive.
I did that and it's still not firing when I test
MUSHclient's Test Trigger... mechanism in the Game menu does not automatically add a line-break after the text you put into it, so if your trigger pattern doesn't end with an "allow anything" wildcard then it won't match, even though it may work on real MUD output. For the test to work properly, you need to explicitly complete the test line by either adding \0A
https://github.com/user-attachments/assets/3035f5f9-eed9-45b8-8d91-3d1844f56816
or pressing Ctrl+Enter as indicated in the bottom right corner of the dialogue.
https://github.com/user-attachments/assets/2e7e5124-3fdf-4c65-9202-20303bd522ff
How do I make multi-state triggers?
See this forum post explaining how to translate the zMUD/CMUD multi-state trigger concept into MUSHclient triggers:
https://www.mushclient.com/forum/bbshowpost.php?bbsubject_id=10338
zMUD lets me add triggers from the input bar. How do I do that in MUSHclient?
See the guide page on that subject here: Command Line Aliases And Triggers
How do I trigger on new GMCP data?
The short answer is that you can't do it with MUSHclient triggers, but you can do something else. Read Using-GMCP to learn about how to do this from inside plugins.