GetTriggerInfo
Script function

world.GetTriggerInfo

DOC_scripting Read about scripting

Type

Method

Summary

Gets details about a named trigger

Prototype

VARIANT GetTriggerInfo(BSTR TriggerName, short InfoType);

DOC_data_types View list of data type meanings


Description

Gets details about the specified trigger.

You can obtain one of 36 "types" of information about the trigger by specifying an "InfoType". The possible InfoTypes are:

1: What to match on (string)
2: What to send (string)
3: Sound to play (string)
4: Script procedure name (string)
5: Omit from log (boolean)
6: Omit from output (boolean)
7: Keep evaluating (boolean)
8: Enabled (boolean)
9: Regular expression (boolean)
10: Ignore case (boolean)
11: Repeat on same line (boolean)
12: Play sound if inactive (boolean)
13: Expand variables (boolean)
14: Which wildcard to send to clipboard (short)
15: Send to - see below (short)
16: Sequence (short)
17: Match on (colour/style) (short)
18: Change to style (short)
19: Change to colour (short)
20: Invocation count (long)
21: Times matched (long)
22: Date/time trigger last matched (date)
23: 'temporary' flag (boolean)
24: Trigger was included from an include file (boolean)
25: Make wildcards lower case flag (boolean)
26: Group name (string)
27: Variable name (string)
28: User option value (long)
29: Other colour foreground colour value (long)
30: Other colour backgroundground colour value (long)
31: Number of matches to regular expression (most recent match) (long)
32: The string we matched against (last trigger text matched against) (string)
33: Executing-script flag (boolean)
34: Script is valid flag (boolean)
35: Error number from PCRE when evaluating last match (long), zero if none
36: 'one shot' flag (boolean)

101: Wildcard %1 from last time it matched
102: Wildcard %2 from last time it matched
103: Wildcard %3 from last time it matched
104: Wildcard %4 from last time it matched
105: Wildcard %5 from last time it matched
106: Wildcard %6 from last time it matched
107: Wildcard %7 from last time it matched
108: Wildcard %8 from last time it matched
109: Wildcard %9 from last time it matched
110: Wildcard %0 from last time it matched

Other wildcards can be extracted by using GetTriggerWildcard.

The word in brackets indicates the "type" of data returned.
String: a character string (eg. "north")
Boolean: TRUE or FALSE
Short: a 16-bit number
Long: a 32-bit number

The field "send to" indicates where the trigger response (item 2) gets sent:

0: World
1: Command window
2: Output window
3: Status line
4: Notepad (new)
5: Notepad (append)
6: Log File
7: Notepad (replace)
8: Command queue
9: Send To Variable
10: Execute (re-parse as command)
11: Speedwalk (send text is speedwalk, queue it)
12: Script (send to script engine)
13: Immediate (send to world in front of speedwalk queue)
14: Script - after omit (send to script engine, after omitting matching line from output)

The field "invocation count" is a count of how many times the script routine was called.
The field "times matched" is a count of how many times the trigger matched. These two would normally be the same, unless scripting was disabled, or there was an error in the script file.

If the named trigger does not exist, EMPTY is returned. If the name given is invalid, NULL is returned. If the InfoType given is out of range, NULL is returned. (Use "IsEmpty" and "IsNull" to test for these possibilities).

For a detailed description about the meanings of the fields, see AddTrigger.

If GetTriggerInfo is called from within a plugin, the triggers for the current plugin are used, not the "global" MUSHclient triggers.

If you want to information about a trigger in another plugin, or the global MUSHclient triggers, use "GetPluginTriggInfo".



VBscript example

world.note world.gettriggerinfo ("monster", 2)



Jscript example

/world.note(world.gettriggerinfo ("monster", 2));



PerlScript example

/$world->note ($world->gettriggerinfo ("monster", 2));



Python example

world.note(world.gettriggerinfo ("monster", 2))



Lua example

Note (GetTriggerInfo ("monster", 2))



Lua notes

Lua returns nil where applicable instead of an "empty variant" or "null variant".



Return value

The specified information about the trigger, as described above.
An EMPTY variant, if the trigger does not exist.
A NULL variant if the trigger name is invalid.
A NULL variant if the InfoType is not a valid type.




See Also ...

Topics

DOC_aliases Aliases
DOC_defaults Default triggers/aliases/timers/macros/colours
DOC_starting Getting started
DOC_group Groups
DOC_plugins Plugins
DOC_regexp Regular Expressions
DOC_timers Timers
DOC_triggers Triggers

Functions

FNC_AddTrigger AddTrigger (Adds a trigger)
FNC_AddTriggerEx AddTriggerEx (Adds a trigger - extended arguments)
FNC_DeleteTemporaryTriggers DeleteTemporaryTriggers (Deletes all temporary triggers)
FNC_DeleteTrigger DeleteTrigger (Deletes a trigger)
FNC_DeleteTriggerGroup DeleteTriggerGroup (Deletes a group of triggers)
FNC_EnableTrigger EnableTrigger (Enables or disables a trigger)
FNC_EnableTriggerGroup EnableTriggerGroup (Enables/disables a group of triggers)
FNC_GetInfo GetInfo (Gets information about the current world)
FNC_GetPluginTriggerInfo GetPluginTriggerInfo (Gets details about a named trigger for a specified plugin)
FNC_GetPluginTriggerList GetPluginTriggerList (Gets the list of triggers in a specified plugin)
FNC_GetTrigger GetTrigger (Gets details about a named trigger)
FNC_GetTriggerList GetTriggerList (Gets the list of triggers)
FNC_GetTriggerOption GetTriggerOption (Gets the value of a named trigger option)
FNC_GetTriggerWildcard GetTriggerWildcard (Returns the contents of the specified wildcard for the named trigger)
FNC_IsTrigger IsTrigger (Tests to see if a trigger exists)
FNC_SetTriggerOption SetTriggerOption (Sets the value of a named trigger option)

(Help topic: function=GetTriggerInfo)

DOC_contents Documentation contents page