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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Problem with Aliases
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Tia
(2 posts) Bio
|
| Date
| Sat 13 Oct 2001 02:08 AM (UTC) |
| Message
| I'm having a problem with understanding how to use the aliases in general; the aliases in Zmud had less symbols and checkboxes, but I really want to know how to use MUSHclient as it's much faster than the version of Zmud I'm using.
One of the aliases I've tried making was something for "focus <direction> <target>". I shortened it to "fn" in Zmud, f standing for focus, and n being the direction north. (I had to make an alias for each direction though.) Then I would type fn x, where x is the first letter of my target's name.
However, when I tried this in MUSHclient, it ate up my "x", appearing only as "focus north". I've tried it with *s and the strange ^& thing I found in the website, but it only came out as "focus north *" or even "fn x".
Is there a way I can overcome this problem? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Sat 13 Oct 2001 06:22 AM (UTC) |
| Message
| This should be easy to do. You want to put in asterisks to match the wildcard text, and refer to them as %1, %2 etc. in the sent text. For instance:
Alias: f* *
Send: focus %1 %2
Now if you type: fn x
It will send: focus n x
This example only requires a single alias too.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #2 on Sat 13 Oct 2001 06:30 AM (UTC) Amended on Sat 13 Oct 2001 06:31 AM (UTC) by Nick Gammon
|
| Message
| The only problem with the above solution is that it will match on any word starting with f, so that if you type:
froggle newt
it would send "focus roggle newt"
For a more precise solution you could use regular expressions, like this:
Alias: ^f([nsew]) (\w+)$
Send: focus %1 %2
Regular expression: checked
This looks a bit weirder but if very specific. It matches on:
- Start of line (^)
- Then the letter 'f'
- Then one only of the letters 'n', 's', 'e', or 'w'
- A space
- One or more "word" characters (ie. letters) represented by \w (word character) followed by "+" (meaning one or more)
- End of line ($)
The round brackets indicate which parts of the matched text are to be collected into the %1 and %2 fields.
This therefore will match on "fn blah" but not "find cave" - which is probably better for you.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Tia
(2 posts) Bio
|
| Date
| Reply #3 on Sat 13 Oct 2001 03:12 PM (UTC) |
| Message
| Thanks so much for the help =)
I've tried applying the alias you gave for other things, such as o([nsew]) for open <direction>, but it doesn't seem to work. Could you tell me how many other ways are there to end off the alias, and when can they be used? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #4 on Sat 13 Oct 2001 10:02 PM (UTC) Amended on Sat 13 Oct 2001 10:03 PM (UTC) by Nick Gammon
|
| Message
| I would need to see the whole alias to comment, but first, the important thing is to check the "regular expression" box if you are using that sort of alias.
If you just want to have something like "on" being "open north" (and so on), then your idea should have worked. eg.
Alias: ^o([nsew])$
Send: open %1
Regular expression: checked
There is a file "RegularExpressions.txt" that is distributed with MUSHclient that explains the regular expression syntax in some detail.
Also, check out this web page:
http://www.gammon.com.au/mushclient/funwithtriggers.htm
Although it is talking about triggers, not aliases, a lot of the concepts are similar, and it describes quite a bit about using regular expressions.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
19,239 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top