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, confirm your email, resolve issues, 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 ➜ Tips and tricks ➜ Combining aliases with RegExp

Combining aliases with RegExp

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


Posted by Thaeldan   Norway  (7 posts)  Bio
Date Sun 04 Mar 2001 04:20 PM (UTC)
Message
This tutorial will show you how to combine aliases into a single alias with MUSHClient's Regular Expression feature.

In this example we will create an alias that fetches a potion from a bag and then quaffs it.

The alias looks like this:

^(misty|orange|yellow|clear|green)$

Inside the parenthesis are the names of different potions separated by "|" which is the OR character for Regular Expressions. This means that it will only match one of the potions inside, but nothing else.

The "^" at the beginning tells MUSHClient to look for the potions only if they appear at the beginning of a line, this will prevent it from matching e.g.:

give green Thaeldan

The "$" at the end of the line, does the opposite of "^" telling MUSHClient that it will only match if you write a potions name without anything after it, thus eliminating e.g.:

yellow stone of brick

To add the alias, press Shift-Ctrl-9 on the keyboard, you should see a dialog similar to the one below:

Click "Add" and enter the alias as below:



Alias: ^(misty|orange|yellow|clear|green)$

Send: g %1 bag
      q %1

Enabled: checked
Regular expression: checked




The lines "g %1 bag" and "q %1" are what we will send to the mud, it's very basic. "g" is an abbreviation for "get" and "%1" is the first parameter passed by the alias, in our case one of the potions. Finally the "q %1" will quaff one of the potions.

To use the alias simply type e.g.: "misty" on the command line and press enter, this will send:


g misty bag
q misty


Neat huh? And all in one alias!

-Thaeldan
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.


8,873 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.