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

AddAlias

Script function

world.AddAlias

Read about scripting

Type

Method

Summary

Adds an alias

Prototype

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

View list of data type meanings

Description

Adds a alias to the list of aliases.

Name: name of this alias - may be empty (see rules for names below)
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 eKeepEvaluating = 8 ' keep evaluating
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 eKeepEvaluating = 8; // keep evaluating
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 $eKeepEvaluating = 8; # keep evaluating

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


* Rules for names

Names of triggers, aliases, timers and variables must follow these rules:

a. Start with a letter (A-Z)
b. Be followed by letters (A-Z), numbers (0-9) or the underscore character (_)


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
KeepEvaluating = 8 
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

View list of return code meanings

See Also ...

Topics

Aliases
Auto-mapper
Default triggers/aliases/timers/macros/colours
Getting started
Groups
Keypad navigation
Macro keys
Plugins
Regular Expressions
Speed walking
Timers
Triggers

Functions

(DeleteAlias) Deletes an alias
(DeleteAliasGroup) Deletes a group of aliases
(DeleteGroup) Deletes a group of triggers, aliases and timers
(DeleteTemporaryAliases) Deletes all temporary aliases
(EnableAlias) Enables or disables an alias
(EnableAliasGroup) Enables/disables a group of aliases
(EnableGroup) Enables/disables a group of triggers, aliases and timers
(GetAlias) Gets details about an alias
(GetAliasInfo) Gets details about an alias
(GetAliasList) Gets the list of aliases
(GetAliasOption) Gets the value of a named alias option
(GetAliasWildcard) Returns the contents of the specified wildcard for the named alias
(GetPluginAliasInfo) Gets details about a named alias for a specified plugin
(GetPluginAliasList) Gets the list of aliases in a specified plugin
(GetPluginAliasOption) Gets the value of a named alias option for a specified plugin
(ImportXML) Imports configuration data in XML format
(IsAlias) Tests to see if an alias exists
(SetAliasOption) Sets the value of a named alias option

(Help topic: function=AddAlias)

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]