Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to "verify" your details, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ MUSHclient ➜ Getting Started ➜ Making aliases

Making aliases

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Sun 05 Aug 2007 12:12 AM (UTC)

Amended on Sun 05 Aug 2007 12:15 AM (UTC) by Nick Gammon

Message

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:

Aliases configuration

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:

Edit an alias

The alias now appears in the alias list. I can select it and click Edit to make changes later on, if I wish.

Aliases list

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:

Alias with wildcard

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:

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:

Variables

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":

Targetting alias

Now when I type "target kobold" I get a confirmation in the output window from the small script:

Targetting alias example

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":

Targetting alias example


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,062 posts)  Bio   Forum Administrator
Date Reply #1 on Fri 24 Jul 2009 01:41 AM (UTC)

Amended on Tue 26 Nov 2013 03:42 AM (UTC) by Nick Gammon

Message
This page has a link to a video showing a tutorial on how to make and use a targetting alias:

http://www.gammon.com.au/forum/?id=9616

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Zurishaddai   (3 posts)  Bio
Date Reply #2 on Thu 09 Aug 2012 02:55 AM (UTC)
Message
i no the thread is marked 2007 but would a rescue alias be pretty much the same concept of a targeting alias?
Top

Posted by Spider_Curt   USA  (3 posts)  Bio
Date Reply #3 on Thu 09 Aug 2012 10:34 AM (UTC)
Message
Zurishaddai said:

i no the thread is marked 2007 but would a rescue alias be pretty much the same concept of a targeting alias?

Sure, I've applied this to many different situations. Just replace kick with whatever other action you wish to take.

You might find this thread of particular interest:
http://www.gammon.com.au/forum/?id=6602

good luck :)
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


28,476 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.