Script function
world.Execute
Read about scripting
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
Description
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.
Available in MUSHclient 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
Return value
eOK: Executed OK
eWorldClosed: World is closed
eCommandsNestedTooDeeply: Commands nested too deeply
View list of return code meanings
See Also ...
Function
(Send) Sends a message to the MUD
(Help topic: function=Execute)