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

GetTriggerWildcard

Script function

world.GetTriggerWildcard

Read about scripting

Type

Method

Summary

Returns the contents of the specified wildcard for the named trigger

Prototype

VARIANT GetTriggerWildcard(BSTR TriggerName, BSTR WildcardName);

View list of data type meanings

Description

Once a trigger has matched you can extract any of the wildcards for that trigger using this function.

The wildcards can be specified by name or number (if by number pass a string which is the appropriate number).

You can set up a named wildcard like this:

Match: (?P<who>.*) tells you '(?P<what>.*)'

In this case we have 2 wildcards, named "who" and "what".

Now we can extract wildcards like this:

x = GetTriggerWildcard ("mytrigger", "who") ' get wildcard named 'who'
x = GetTriggerWildcard ("mytrigger", "what") ' get wildcard named 'what'
x = GetTriggerWildcard ("mytrigger", "22") ' get wildcard 22 (if it exists)

You can have up to 999 wildcards, plus wildcard 0 which represents the entire matching string.

You can use GetTriggerInfo selector 31 to find how many wildcards matched.

Each wildcard will have a number and may optionally have a name.


Available in MUSHclient version 3.48 onwards.



VBscript example

dim x

x = GetTriggerWildcard ("mytrigger", "who")  ' get wildcard named 'who'
x = GetTriggerWildcard ("mytrigger", "what") ' get wildcard named 'what'
x = GetTriggerWildcard ("mytrigger", "22")   ' get wildcard 22 (if it exists)


Lua example

local x

x = GetTriggerWildcard ("mytrigger", "who")  -- get wildcard named 'who'
x = GetTriggerWildcard ("mytrigger", "what") -- get wildcard named 'what'
x = GetTriggerWildcard ("mytrigger", "22")   -- get wildcard 22 (if it exists)


Lua notes

Inside an trigger script function you can access named wildcards by 
simply putting the name after the wildcards argument. eg.

function myTriggerFunction (name, line, wildcards)
  Note (wildcards.who)  --> access named wildcards "who"
end


Return value

The contents of the specified trigger wildcard, as described above.

An EMPTY variant, if the trigger does not exist.

A NULL variant if the trigger name is invalid.

An empty string if the wildcard does not exist. An empty string is the string "", this is different from an EMPTY variant.


See Also ...

Topics

Aliases
Default triggers/aliases/timers/macros/colours
Getting started
Groups
Plugins
Regular Expressions
Timers
Triggers

Functions

(AddTrigger) Adds a trigger
(AddTriggerEx) Adds a trigger - extended arguments
(DeleteTemporaryTriggers) Deletes all temporary triggers
(DeleteTrigger) Deletes a trigger
(DeleteTriggerGroup) Deletes a group of triggers
(EnableTrigger) Enables or disables a trigger
(EnableTriggerGroup) Enables/disables a group of triggers
(GetPluginTriggerInfo) Gets details about a named trigger for a specified plugin
(GetPluginTriggerList) Gets the list of triggers in a specified plugin
(GetTrigger) Gets details about a named trigger
(GetTriggerInfo) Gets details about a named trigger
(GetTriggerList) Gets the list of triggers
(GetTriggerOption) Gets the value of a named trigger option
(IsTrigger) Tests to see if a trigger exists
(SetTriggerOption) Sets the value of a named trigger option
(StopEvaluatingTriggers) Stops trigger evaluation

(Help topic: function=GetTriggerWildcard)

Documentation contents page


Search ...

Enter a search string to find matching documentation.

Search for:   

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 FutureQuest]