Aliases
Aliases let you respond to something you have typed.

For example, an alias "GF" might expand to "open bag; get food"

You can also make aliases invoke scripts, make notes on the screen, do speedwalks, and many other things.

To respond from some text arriving from the MUD, use a trigger instead.

You can use wildcards to put "variable" information into the alias. For example, say you want to make an alias that gets something from your bag, and quaffs it, but the "something" might change from time to time, use an asterisk to represent the unknown thing. For example:

Match: gq *


Send:

get %1 bag
quaff %1


Then you might type:

gq potion


You can have up to 999 wildcards (which become %1 to %9) with %0 representing "the whole matching text". See below for how to access the higher numbered wildcards.




Another example, which uses two wildcards, might be used if you had to prepare a spell before using it.

Match: c * *


Send:

prepare %1
cast %1 %2


Then you might type:

c heal gandalf





Alias scripts

Aliases can execute script commands by simply putting the command into the "send" box and selecting "send to script".

However for more complex scripts you can put scripts into your script file (see scripting configuration tab for the world) and then call the script from the alias. To do this put the name of the script subroutine into the alias's script box.

The script subroutine must have three arguments, as follows:


  • Name of the alias
  • The matching line
  • An array of the first 10 wildcards


An example script in the VBscript language would be:


sub MyAlias (name, line, wildcards)
  world.Note "Alias " & name & " matched."
  world.Note "Wildcard 1 was" & wildcards (1)
end sub


Wildcard 10 is the entire matching sequence, which is not necessarily the same as the matching line in the case of regular expressions.

Other wildcards can be accessed by using the GetAliasWildcard script routine (for example, named wildcards, or wildcards over number 9).




Wildcards

A powerful feature in matching triggers or aliases is the ability to specify "wildcards" which are variable information that might change from time to time.

For example:


k *


In this case the asterisk represents the name of the unknown target you wish to kill.

Using the wildcard in the "send" box ...

To use this unknown quantity you can refer to it as %1 (for the first wildcard) in the "send" box, like this:


kick %1


The second wildcard is %2, and so on. Wildcard %0 is a special case which represents the entire matching text.

For wildcards above 9 you can use this syntax:


kick %<22>


The number in the angled brackets can be from 0 to 999.

Also, if you use regular expressions, you can name wildcards, like this:


^k (?P<target>.*)$


This names the wildcard as "target". You can then use this name in a similar way:


kick %<target>



See Also ...

Topics

DOC_mapper Auto-mapper
DOC_defaults Default triggers/aliases/timers/macros/colours
DOC_starting Getting started
DOC_group Groups
DOC_keypad Keypad navigation
DOC_macros Macro keys
DOC_plugins Plugins
DOC_regexp Regular Expressions
DOC_speed_walking Speed walking
DOC_timers Timers
DOC_triggers Triggers

Command

CMD_ID_GAME_CONFIGURE_ALIASES ConfigureAliases (Define aliases)

Dialogs

DLG_IDD_PREFS_P7 Alias configuration (list)
DLG_IDD_EDIT_ALIAS Edit alias

Functions

FNC_AddAlias AddAlias (Adds an alias)
FNC_DeleteAlias DeleteAlias (Deletes an alias)
FNC_DeleteAliasGroup DeleteAliasGroup (Deletes a group of aliases)
FNC_DeleteTemporaryAliases DeleteTemporaryAliases (Deletes all temporary aliases)
FNC_EnableAlias EnableAlias (Enables or disables an alias)
FNC_EnableAliasGroup EnableAliasGroup (Enables/disables a group of aliases)
FNC_GetAlias GetAlias (Gets details about an alias)
FNC_GetAliasInfo GetAliasInfo (Gets details about an alias)
FNC_GetAliasList GetAliasList (Gets the list of aliases)
FNC_GetAliasOption GetAliasOption (Gets the value of a named alias option)
FNC_GetAliasWildcard GetAliasWildcard (Returns the contents of the specified wildcard for the named alias)
FNC_GetPluginAliasInfo GetPluginAliasInfo (Gets details about a named alias for a specified plugin)
FNC_GetPluginAliasList GetPluginAliasList (Gets the list of aliases in a specified plugin)
FNC_IsAlias IsAlias (Tests to see if an alias exists)
FNC_SetAliasOption SetAliasOption (Sets the value of a named alias option)

(Help topic: general=aliases)

DOC_contents Documentation contents page