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


Script function


Read about scripting




Sets the value of a named alias option


long SetAliasOption(BSTR AliasName, BSTR OptionName, BSTR Value);

View list of data type meanings


Sets the current value of an alias option.

You must specify the name of an existing alias, and an alias option from the list given for GetAliasOption. These are the same names as used in the XML world files for alias options.

Note that you can neither get or set the "name" field. It is listed below for completeness in viewing aliases copied to the clipboard or in world files and plugins. You already know the name when getting the alias option (it is AliasName), and this function is provided to modify existing aliases, not rename them. To change the name of an alias use ExportXML, modify the XML, and then ImportXML.

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

For numeric options (such as "sequence") the supplied string will be converted to a number. It is an error if the string does not consist of digits (0 to 9). For the "user" option an optional leading sign is accepted.

For boolean options (such as "enabled") the supplied string may be:

"y", "Y", or "1" for true
"n", "N", or "0" for false

Also if you are using Lua you can supply simply true or false.

The various option names are:

"echo_alias": y/n - echo alias itself to output window
"enabled": y/n - alias is enabled
"expand_variables": y/n - expand variables (like @target)
"group": (string - group name)
"ignore_case": y/n - caseless matching
"keep_evaluating": y/n - evaluate next alias in sequence
"match": (string - what to match)
"menu": y/n - add alias to menu that appears if you LH click
"name": (string - name/label of alias)
"omit_from_command_history": y/n - omit alias from the command history
"omit_from_log": y/n - omit alias from log file
"omit_from_output": y/n - omit sent text from the output window
"one_shot": y/n - alias is deleted after firing
"regexp": y/n - regular expression
"script": (string - name of function to call)
"send": (multi-line string - what to send)
"send_to": 0 - 13 - "send to" location (see below)
"sequence": 0 - 10000 - sequence number in which to check - lower first
"user": -2147483647 to 2147483647 - user-defined number
"variable": (string - name of variable to send to)

Send-to locations

"0" - send to MUD
"1" - put in command window
"2" - display in output window
"3" - put in status line
"4" - new notepad
"5" - append to notepad
"6" - put in log file
"7" - replace notepad
"8" - queue it
"9" - set a variable
"10" - re-parse as command
"11" - send to MUD as speedwalk
"12" - send to script engine
"13" - send without queuing
"14" - send to script engine - after omitting from output

Available in MUSHclient version 3.29 onwards.

VBscript example

world.SetAliasOption "myalias", "match", "north"

Jscript example

world.SetAliasOption ("myalias", "match", "north");

PerlScript example

$world->SetAliasOption ("myalias", "match", "north");

Python example

world.SetAliasOption ("myalias", "match", "north")

Lua example

SetAliasOption ("myalias", "match", "north")

Lua notes

The "send_to" field can be specified using the "sendto" table in the Lua global address space, as follows:

sendto.world = 0
sendto.command = 1
sendto.output = 2
sendto.status = 3
sendto.notepad = 4
sendto.notepadappend = 5
sendto.logfile = 6
sendto.notepadreplace = 7
sendto.commandqueue = 8
sendto.variable = 9
sendto.execute = 10
sendto.speedwalk = 11
sendto.script = 12
sendto.immediate = 13
sendto.scriptafteromit = 14

You can use true, false or nil for boolean options.

Return value

eInvalidObjectLabel: The alias name is not valid
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
ePluginCannotSetOption: The option is marked as non-settable (in a plugin or not)
eOK: set OK

View list of return code meanings

See Also ...


Default triggers/aliases/timers/macros/colours
Getting started
Keypad navigation
Macro keys
Regular Expressions
Speed walking


(AddAlias) Adds an alias
(DeleteAlias) Deletes an alias
(DeleteAliasGroup) Deletes a group of aliases
(DeleteTemporaryAliases) Deletes all temporary aliases
(EnableAlias) Enables or disables an alias
(EnableAliasGroup) Enables/disables a group of aliases
(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
(IsAlias) Tests to see if an alias exists

(Help topic: function=SetAliasOption)

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.


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]