AddAlias
Script function

world.AddAlias

DOC_scripting Read about scripting

Type

Method

Summary

Adds an alias

Prototype

long AddAlias(BSTR AliasName, BSTR MatchText, BSTR ResponseText, long Flags, BSTR ScriptName);

DOC_data_types View list of data type meanings


Description

Adds a alias to the list of aliases.

Name: name of this alias - may be empty
Match_text: what to match on
Response_text: what to send to the world
Flags: various flags, see list below
ScriptName: Which script subroutine to execute

Flags

The flags can be one or more of the constants below. For example, to enable the alias, and ignore the case of what was typed, the flags would be 33. Preferably use the constant declarations in your script file, and "OR" them together. E.g.

VBscript: eEnabled or eIgnoreAliasCase
JScript: eEnabled | eIgnoreAliasCase

VBscript constants:

const eEnabled = 1 ' enable alias
const eIgnoreAliasCase = 32 ' ignore case when matching
const eOmitFromLogFile = 64 ' omit this alias from the log file
const eAliasRegularExpression = 128 ' alias is regular expressions
const eExpandVariables = 512 ' expand variables like @direction
const eReplace = 1024 ' replace existing alias of same name
const eAliasSpeedWalk = 2048 ' interpret send string as a speed walk string
const eAliasQueue = 4096 ' queue this alias for sending at the speedwalking delay interval
const eAliasMenu = 8192 ' this alias appears on the alias menu
const eTemporary = 16384 ' temporary - do not save to world file

JScript constants:

var eEnabled = 1; // same as for AddTrigger
var eIgnoreAliasCase = 32; // ignore case when matching
var eOmitFromLogFile = 64; // omit this alias from the log file
var eAliasRegularExpression = 128; // alias is regular expressions
var eExpandVariables = 512; // expand variables like @direction
var eReplace = 1024; // replace existing alias of same name
var eAliasSpeedWalk = 2048; // interpret send string as a speed walk string
var eAliasQueue = 4096; // queue this alias for sending at the speedwalking delay interval
var eAliasMenu = 8192; // this alias appears on the alias menu
var eTemporary = 16384; // temporary - do not save to world file


PerlScript constants:

my $eEnabled = 1; # same as for AddTrigger
my $eIgnoreAliasCase = 32; # ignore case when matching
my $eOmitFromLogFile = 64; # omit this alias from the log file
my $eAliasRegularExpression = 128; # alias is regular expressions
my $eExpandVariables = 512; # expand variables like @direction
my $eReplace = 1024; # replace existing alias of same name
my $eAliasSpeedWalk = 2048; # interpret send string as a speed walk string
my $eAliasQueue = 4096; # queue this alias for sending at the speedwalking delay interval
my $eAliasMenu = 8192; # this alias appears on the alias menu
my $eTemporary = 16384; # temporary - do not save to world file



VBscript example

world.addalias "food_alias", "eat", "eat food", eEnabled, ""



Jscript example

world.AddAlias("food_alias", "eat", "eat food", eEnabled, "");



PerlScript example

$world->AddAlias("food_alias", "eat", "eat food", $eEnabled, "");



Python example

world.AddAlias("food_alias", "eat", "eat food", eEnabled, "")



Lua example

AddAlias("food_alias", "eat", "eat food", alias_flag.Enabled, "")



Lua notes

The script name is optional.

The alias flags are built into the "alias_flag" table, as follows:

Enabled = 1
IgnoreAliasCase = 32
OmitFromLogFile = 64
RegularExpression = 128
ExpandVariables = 512
Replace = 1024
AliasSpeedWalk = 2048
AliasQueue = 4096
AliasMenu = 8192
Temporary = 16384



Return value

eInvalidObjectLabel: The alias name is not valid
eAliasAlreadyExists: A alias of that name already exists
eAliasCannotBeEmpty: The "match_text" cannot be empty
eScriptNameNotLocated: The script name cannot be located in the script file
eBadRegularExpression: The regular expression could not be evaluated
eOK: added OK


DOC_errors View list of return code meanings


See Also ...

Topics

DOC_aliases Aliases
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

Functions

FNC_DeleteAlias DeleteAlias (Deletes an alias)
FNC_DeleteAliasGroup DeleteAliasGroup (Deletes a group of aliases)
FNC_DeleteGroup DeleteGroup (Deletes a group of triggers, aliases and timers)
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_EnableGroup EnableGroup (Enables/disables a group of triggers, aliases and timers)
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_ImportXML ImportXML (Imports configuration data in XML format)
FNC_IsAlias IsAlias (Tests to see if an alias exists)
FNC_SetAliasOption SetAliasOption (Sets the value of a named alias option)

(Help topic: function=AddAlias)

DOC_contents Documentation contents page