Trigger Definition
A Trigger allows the MudMagic client to automatically execute a command or series of command based on the output of
your screen. So if you want to congratulate someone everytime they level, you can create a trigger to automatically
chat a congratulations when the string 'Kelmar has reached level 20' is viewed. To create this type of trigger, a
little regular expression is required.
All alias events use PCRE (perl compatible regular expression). What this means, is if you create an alias called just: test, then if you input anything on the command line that contains the word "test" in it, the alias will trigger. For example, the following This isatest would trigger an alias with a Statement setting of "test". Thus, make sure to check your PCRE settings. What you want to use for just a 'test' input statement would actually be: ^test. Since the Statement trigger is PCRE based, you can pass arguments through to a back end script - or just output plain text for the simpler aliases.
A full pattern match with Regex for an event such as: Flicker tells you 'Hi there'. would appear as:
Name: Automatic Reply Statement: (.*) tells you '(.*)'. Action: (Script) BASIC: print "tell $1 Sorry I missed your message, I've written it down though" print "note to Kyndig;note subject Missed Message from $1" print "note + $2" print "note post" |
Trigger Editing
To edit a Trigger, you fill out the Name, Statement, and select the action.
The Trigger: is either a basic line pattern match: has entered the game or a regular expression: (.*) has entered the game.
Scope of Triggers
Triggers can be stored as Local game triggers, or Global world triggers. Local game triggers are only available for
that specific game you are connected to - whereas Global world triggers are available to any game you are connected to.
For Global Trigger editing - visit: Setting -> Global Settings -> Actions -> Triggers.
To edit your local game alias, visit: Profile -> Actions -> Triggers when connected to a game.
All triggers are stored and saved on a per-game basis. So each game has its own unique triggers system. Global triggers are the only exception to this rule - where they are available to any game. Triggers can also be imported/exported on a game-by-game basis through the Import/Export feature.
Scripting Support
Triggers can use either Python or the MudMagic BASIC scripting language. For more assistance in BASIC and Python
scripting, see: Scripting to the left.
Trigger Examples
Triggers allow you to react automatically to text that comes from the MUD. This reaction can be of two forms: sending
something to the MUD in reply, or there may be no direct interaction with the MUD, but something might be printed in
the screen, or something else done to call your attention. With the use of Perl PCRE, you can pass arguments to the
MudMagic command interpreter to perform some BASIC script support if desired.
Example 1: Name: Someone Died Statement: has been killed in battle Action: Text -------------------- chat comforts |
Example 2: Name: |
restore Kyndig chat comforts Kyndig