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

MUSHclient scripting

Description of MUSHclient world function: world.Execute

Name Execute
Type Method
Summary Executes a command as if you had typed it into the command window
Prototype long Execute(BSTR Command);

View list of data type meanings


The Execute function lets you execute arbitrary commands as if they were typed into the command window.

The command will be parsed exactly the same as the command window parser, depending on currently-set options (eg. speedwalking, command stacking, scripting etc.).

The only difference is that the command will:

* Not be placed in the command history (as you didn't actually type it in)
* Not unpause the output window if it is paused

There is a possibility that you might accidentally nest calls to execute, for example if an alias called itself, so MUSHclient limits nested calls to the Execute function to 20 levels of nesting.

Note that the Execute function ignores the auto-say setting. Thus you can still use Execute to do things, even if the player has turned on auto-say for a quick chat. However if you are planning to do script commands you will need to be sure that the scripting prefix has not changed.

If you are planning to execute a script using Execute you should probably find the current script prefix (using world.GetOption) rather than relying it on being the same all the time.

Note: Available in version 3.35 onwards.

VBscript example
world.Execute "north"  ' normal command
world.Execute "#4s 3e"  ' speed walk
world.Execute "/world.Debug ""colours "" "  ' execute a script
Jscript example
world.Execute ("north");  // normal command
world.Execute ("4s 3e");  // speed walk
world.Execute ("/world.Debug ("colours ") ");  // execute a script
PerlScript example
$world->Execute ("north");  # normal command
$world->Execute ("4s 3e");  # speed walk
Python example
world.Execute ("north")  # normal command
world.Execute ("4s 3e")  # speed walk
world.Execute ("world.Debug ("colours ") ")  # execute a script
Lua example
Execute ("north")  -- normal command
Execute ("4s 3e")  -- speed walk
Execute ("/Debug ('colours') ")  -- execute a script
Returns eOK: Executed OK
eWorldClosed: World is closed
eCommandsNestedTooDeeply: Commands nested too deeply

View list of return code meanings

Introduced in version 3.35

See also ...

Function Description
Send Sends a message to the MUD

Search for script function

Enter a word or phrase in the box below to narrow the list down to those that match.

The function name, prototype, summary, and description are searched.

Search for:   

Leave blank to show all functions.

Return codes

Many functions return a "code" which indicates the success or otherwise of the function.

You can view a list of the return codes

Function prototypes

The "prototype" part of each function description lists exactly how the function is called (what arguments, if any, to pass to it).

You can view a list of the data types used in function prototypes

View all functions


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]