Scripting - getting started

Posted by Nick Gammon on Sun 17 Oct 2004 02:38 AM — 1 posts, 6,022 views.

Australia Forum Administrator #0
Scripting lets you extend the behaviour of MUSHclient to do almost anything you want.

You can script in one of (currently) four script languages: VBscript, JScript, PerlScript, and Python. If you use plugins you can also have multiple script languages per session (a different one per plugin).

How do scripts get called?

MUSHclient will call a function (or subroutine) in your script at various places you can specify. For instance, each trigger, timer or alias can call a script. Information about the trigger, alias and timer (such as its name, and the matching line) is passed to the script routine so it can react appropriately.

For example, you might make a trigger script that kept count of the number of times you levelled when playing a MUD.

You can also specify that scripts get called when other events happen, like "world open", "world connect", "new chat user" and so on.

How do scripts communicate with MUSHclient?

Scripts use the COM (Component Object Model) technology to send requests to MUSHclient or ask for information. For example, you can use "Note" to tell MUSHclient to put a note in the output window, or "GetInfo" to find out information about the current world (like when it was connected).

Scripts use the "world" COM object to do this - this is available in all script languages. For example:


world.Note "Hello, there"


Where do scripts go?

You have a number of options for placing script routines -

  1. In a script file which is used by the world (these can be shared between worlds).
  2. Each plugin you install can have scripts in it.
  3. Triggers, aliases and timers can call a script functions directly from inside them, without needing a separate script file.


Script functions

There is extensive documentation about the script functions, including a list of all of them, at the web page:



Additional help

There is also documentation on the Windows Script Engine (VBScript, JScript) on Microsoft's site, and is available for download at:


http://msdn.microsoft.com/library/default.asp?url=/nhp/default.asp?contentid=28001169