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

MUSHclient simple alias script

MUSHclient logo - 15K

Updated 12th June 1997.


In a lot of worlds, you teleport yourself around to key locations, but remembering those room numbers is somewhat of a pest. This script that I present here shows how you can translate easy-to-remember room names into a room number to teleport to.

Let us say, for example, that you have a room called "oasis" that you teleport to a lot. Its room number is 19, so using normal MUSH commands you would have to type:

However, by using the alias and script presented below, you can now type:

Setting up the script subroutine

I'll assume that you have installed VBscript by this time. If so, you should be able to type the command: and see "Hi there" appear in your output window. If not, see the page: scripting setup for more details.

Next, use Notepad (or some other text editor) to edit the script file (the file whose name appears on the "scripts" configuration page) and add the following subroutine:

What is happening above is:
  1. The script declares two "variables" (things which can hold numbers or strings or other things), named "sDestination" and "iRoom".
  2. The third parameter passed into the script subroutine (called "thewildcards" here, but you could call it anything) is the list of wildcards to the alias, in other words "whatever the user typed after the word TELEPORT".
  3. This first wildcard ("thewildcards (1)") is "trimmed" by using the "Trim" function. This removes leading and trailing spaces, and moved into the variable "sDestination" in the process.
  4. If the destination is blank (ie. the user typed nothing in) then the program echoes the possible teleport locations, and exits the subroutine.
  5. Otherwise, using the "select case" statement the variable "sDestination" (forced to upper-case by the "uCase" function) is tested against all the possible destinations, and if it matches, the appropriate room number is moved into "iRoom".
  6. If there is no match, a warning message is displayed (using world.note) and the subroutine exits.
  7. If there is a match, the subroutine displays an informative message, and then sends the appropriate teleport command to the world.

Linking the alias to the script

The only thing that remains is to add an alias called "teleport" (you could make it "tel" if you want to save some typing), and tell it to call the script subroutine "OnTeleport" (ie. the one you just created) if someone types "teleport".

The resulting alias will look like this:

Example of alias - 5K

Test it out!

Having typed in the script, and set up the alias, you are ready to try it! Here is what it looked like for me...

Example of alias - 5K

If you get syntax errors, just edit the script file and correct them. If you are using Window NT, MUSHclient will automatically detect that you have changed the script file and offer to reprocess it. If you are using Windows 95, just use the "reload script file" function (Shift+Ctrl+R).

Change to suit your requirements

Of course, you would want to change the script to reflect both the room names and numbers that pertain to your own worlds. Hopefully this example will inspire you to start creating your own scripts. If you make an interesting one, please email it to me (address below) so I can add it to the example scripting pages.

More complex example...

The major problem with this script from a MUSHing point of view, is that you have to recompile it every time you want to add a new room to the list. Click here for scripting a complex alias.
[Previous] [Next] [Back] [Home]
Written by Nick Gammon - 5K

Comments to Gammon Software support

[Best viewed with any browser - 2K]    Internet Contents Rating Association (ICRA) - 2K    [Web site powered by FutureQuest.Net]

Page updated on Tuesday, 6 December 2005