world.GetTriggerList

MUSHclient script function (Method)

Gets the list of triggers

Prototype

VARIANT GetTriggerList();

Data type meanings

Description

Returns an array of all the named triggers currently defined. You can then use GetTrigger or GetTriggerInfo to find out more details about each one.

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

If you want to find the list of triggers in another plugin, or the global MUSHclient triggers, use "GetPluginTriggerList".

Note - from version 3.30 onwards GetTriggerList returns all triggers, even unlabelled ones. The unlabelled triggers will have assigned an "internal" label (like "*trigger42") that can be used in GetTriggerInfo, and similar routines.

VBscript example

dim trList

trList = world.GetTriggerList

If Not IsEmpty (trList) then

  For Each t In trList 
    world.Note t 
  Next

End If

Jscript example

triggerlist = new VBArray(world.GetTriggerList()).toArray();

if (triggerlist)  // if not empty
 for (i = 0; i < triggerlist.length; i++)
   world.note(triggerlist [i]);

PerlScript example

foreach $item (Win32::OLE::in ($world->GetTriggerList))
 {
 $world->note($item);
 }

Python example

triggerlist = world.GetTriggerList
if (triggerlist ):
  for t in triggerlist : world.Note (t)

Lua example

tl = GetTriggerList()
if tl then
  for k, v in ipairs (tl) do 
    Note (v) 
  end  -- for
end -- if we have any triggers

Lua notes

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

Return value

If there are no triggers (with names) then the return value is empty. Use "IsEmpty" to test for this possibility.

Otherwise, it returns a variant array containing the names of all the triggers. Use "ubound" to find the number of triggers in the list. You can then use "GetTrigger" to find details about each trigger. See the example for how to do this. You can paste this example into an "Immediate" window (CTRL+I) to test it.

Related topic

Triggers

See also

FunctionDescription
AddTriggerAdds a trigger
DeleteTriggerDeletes a trigger
EnableTriggerEnables or disables a trigger
GetPluginTriggerListGets the list of triggers in a specified plugin
GetTriggerGets details about a named trigger
GetTriggerInfoGets details about a named trigger
IsTriggerTests to see if a trigger exists