Another way of saving typing is to make an alias. Aliases match on something you type, and can be used to substitute something else, or do some other action (like call a script). First, let's replace having to type "task available" lots of times, by typing "ta" instead. First, we press Alt+Enter to open the world configuration, and click on "Aliases" on the left, and then "Add" to add a new one:
We only need to type in two things in this case. The alias "match" (which is "ta") and the alias "send text" (which is "task available"). Fill in these fields, and click OK:
The alias now appears in the alias list. I can select it and click Edit to make changes later on, if I wish.
You can now type "ta" in the command window, and it will send "task available" to the MUD. The "ta" is not echoed, but "task available" is (in the output window). You can tweak that behaviour by editing the alias, and checking various other boxes (to echo the alias itself, check "Echo Alias", to not see what the alias is sending, check "Omit From Output").
Now let's make an alias that takes a variable parameter. For example, say when fighting we often need to kick our opponent. Rather than typing "kick kobold" all the time, it would be quicker to type "k kobold". The word "kobold" will vary, so we want to make that a "wildcard". Add a new alias, and this time match on "k *". That means "k" followed by a space, and then anything else:
In the "send" field we put "kick" followed by %1. In the send box for aliases and triggers, %1 refers to the first wildcard (and %2 the second wildcard, and so on).
You might be wondering why you need to type "kobold" (or whatever the mob name is) each time you want to kick it. To save even more typing, we can make a targetting alias, that defines our current target. Then we can make a "kick" alias that kicks whoever the target is. First, the targetting alias:
This lets you type "target kobold", and if you do, the first wildcard (%1) is sent to a variable (which is part of the MUSHclient world). In this case I have named the variable "target". I needed to fill in two extra fields, the "send to" combo-box has been changed to "Variable", and the variable name typed into the "Variable" field near the bottom of the alias. Now, having clicked OK to save the alias, I can then type "target kobold" in the command window. Nothing seems to happen, so let's check the variable configuration to see if the target was set. Hit Alt+Enter to open the world configuration, and check the Variables section:
It would be nice to get confirmation we have changed our target, so with slightly more work, we can do that. This time the alias will "send to script". Scripting is a powerful way of doing more complex things. The default is for Lua to be the scripting language, which is fine for this application. Simply change the "send" box to do a small script (two lines), and change the "send to" combo-box to read "Script":
Now when I type "target kobold" I get a confirmation in the output window from the small script:
Finally, to tie this all together, we need a new alias, so that when I just type "k", it kicks the current target. So, we add a new alias, enter "k" in the match field (we don't need a wildcard this time), and then in the "send field" we put "kick @target". We also have to check "Expand Variables". Now when we type "k", MUSHclient will substitute whatever the contents of the "target" variable is, where it sees "@target":
|