Newbie question regarding aliases

Posted by Banon on Mon 02 Jun 2003 05:40 PM — 6 posts, 22,636 views.

#0
Hi -
I'm entirely new to aliases. What exactly does the "%1" mean? For example, say I wanted to get "something" from bag and quaff it. How does the %1 come into play? Thanks for your help. Also, is there a place where I can get additional info on making aliases, variables, etc?
Greece #1
If you make a trigger that includes an asterisk (*), %1 matches it. For example, if you have a trigger that is:
* gives * a *.
and the "send" text is:
Say %1 gave %2 a %3!

If the MUD outputs something like:
Poromenos gives Banon a copy of MUClient's helpfile.

the trigger will send:

Say Poromenos gave Banon a copy of MUClient's helpfile!

"Poromenos" was the first asterisk, %1, "Banon" was %2, and "a copy of MUClient's helpfile" was %3.
Greece #2
Oh, if you want to make an alias that gets something from a bag and quaffs it, use this text as the alias:

gq *

and send:

get %1 bag
quaff %1

That'll do the trick.
#3
Ahh I think I get it now. In your 2nd example, whatever is typed in place of the "*" is matched with the %1 in the "send commands". Thanks for your help :)
#4
all the *'s don't necessarily correlate with %1, for instance the first * correlates with %1, while the second correlates with %2, and the third with %3 and so on up to %9. I forget what %0 correlates with, I think maybe all of the asterisks or something. I just read that in a help file, I'm a newb to MUSHClient too *g*
Australia Forum Administrator #5
%0 is "the entire matching text" which in the case of non-regular expressions is the whole line, however in the case of regular expressions it is whatever matches the expression.

For example:

* says *

If this matched "Nick says hello" then %0 would be "Nick says hello".

However if using a regular expression:

says (.*)

This would also match, however now %0 is "says hello".