[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

MUSHclient scripting

Description of MUSHclient world function: world.GetTriggerOption


Name GetTriggerOption
Type Method
Summary Gets the value of a named trigger option
Prototype VARIANT GetTriggerOption(BSTR TriggerName, BSTR OptionName);
Description

Gets the current value of a trigger option.

You must specify the name of an existing trigger, and a trigger option from the list below. These are the same names as used in the XML world files for trigger options.

Note that you can neither get or set the "name" field. It is listed below for completeness in viewing triggers copied to the clipboard or in world files and plugins. You already know the name when getting the trigger option (it is TriggerName), and this function is provided to modify existing triggers, not rename them. To change the name of a trigger use ExportXML, modify the XML, and then ImportXML.

The return type is Variant, so the returned value will be the appropriate type for the data (ie. string or number (long)).

If the option name is not known, or is not allowed to be retrieved, a NULL variant is returned.

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

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

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

To find options for other plugins, use GetPluginTriggerOption.

The various option names are:

"clipboard_arg": 0 - 10 - which wildcard to copy to the clipboard
"colour_change_type": 0=both, 1=foreground, 2=background
"custom_colour": 0=no change, 1 - 16, 17=other
"enabled": y/n - trigger is enabled
"expand_variables": y/n - expand variables (like @target)
"group": (string - group name)
"ignore_case": y/n - caseless matching
"inverse": y/n - only match if inverse, however see match_inverse
"italic": y/n - only match if italic, however see match_italic
"keep_evaluating": y/n - evaluate next trigger in sequence
"lines_to_match": 0 - 200 - how many lines to match for multi-line triggers
"lowercase_wildcard": y/n - make matching wildcards lower-case
"match": (string - what to match)
"match_style": (see below) - what style and colour combination to match on
"multi_line": y/n - multi-line trigger
"name": (string - name/label of trigger)
"new_style": (style(s) to change to: (bold (1) / underline (2) / italic (4) ) )
"omit_from_log": y/n - omit matching line from log file
"omit_from_output": y/n - omit matching line from output window
"one_shot": y/n - trigger is deleted after firing
"other_back_colour": (string - name of colour to change to)
"other_text_colour": (string - name of colour to change to)
"regexp": y/n - regular expression
"repeat": y/n - repeatedly evaluate on same line
"script": (string - name of function to call)
"send": (multi-line string - what to send)
"send_to": 0 - 14 - "send to" location (see below)
"sequence": 0 - 10000 - sequence in which to check - lower first
"sound": (string - sound file name to play)
"sound_if_inactive": y/n - play sound even if world inactive
"user": -2147483647 to 2147483647 - user-defined number
"variable": (string - name of variable to send to)

Options that match on colour, bold, inverse or underline are tested against the first matching character.

Boolean options (shown as y/n) are returned as 0 for false (n) or 1 for true (y).

Send-to locations

"0" - send to MUD
"1" - put in command window
"2" - display in output window
"3" - put in status line
"4" - new notepad
"5" - append to notepad
"6" - put in log file
"7" - replace notepad
"8" - queue it
"9" - set a variable
"10" - re-parse as command
"11" - send to MUD as speedwalk
"12" - send to script engine
"13" - send without queuing
"14" - send to script engine - after omitting from output



Trigger match_style field will be as follows (in hex nibbles):

TBFS

T = what style to test
B = background colour
F = foreground colour
S = what style bits are wanted

Style bits:

NORMAL 0x0000 // normal text
HILITE 0x0001 // bold
UNDERLINE 0x0002 // underline
BLINK 0x0004 // italic (sent to client as blink)
INVERSE 0x0008 // need to invert it


MATCH_TEXT 0x0080 // match on text colour?
MATCH_BACK 0x0800 // match on background colour?
MATCH_HILITE 0x1000 // match on bold bit?
MATCH_UNDERLINE 0x2000 // match on underline?
MATCH_BLINK 0x4000 // match on blink?
MATCH_INVERSE 0x8000 // match on inverse?

Colours:

BLACK = 0
RED = 1
GREEN = 2
YELLOW = 3
BLUE = 4
MAGENTA = 5
CYAN = 6
WHITE = 7


See the forum posting at http://www.gammon.com.au/forum/?id=4873 for more details about match_style.


Note: Available in version 3.29 onwards.


VBscript example
Note world.GetTriggerOption ("mytrigger", "match")
Jscript example
Note (world.GetTriggerOption ("mytrigger", "match"));
PerlScript example
$world->Note ($world->GetTriggerOption ("mytrigger", "match"));
Python example
Note (world.GetTriggerOption ("mytrigger", "match"))
Lua example
Note (GetTriggerOption ("mytrigger", "match"))
Lua notes
Lua returns nil where applicable instead of an "empty variant" or "null variant".
Returns As described above.
Introduced in version 3.29

See also ...

Function Description
AddTrigger Adds a trigger
AddTriggerEx Adds a trigger - extended arguments
GetPluginTriggerOption Gets the value of a named trigger option for a specified plugin
GetTriggerInfo Gets details about a named trigger
SetTriggerOption Sets the value of a named trigger option

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.


Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes


Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes


View all functions

[Back]

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]