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.

Due to spam on this forum, all posts now need moderator approval.

 Entire forum ➜ MUSHclient ➜ Tips and tricks ➜ Newbie question regarding aliases

Newbie question regarding aliases

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


Posted by Banon   (2 posts)  Bio
Date Mon 02 Jun 2003 05:40 PM (UTC)
Message
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?
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #1 on Mon 02 Jun 2003 06:08 PM (UTC)
Message
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.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Poromenos   Greece  (1,037 posts)  Bio
Date Reply #2 on Mon 02 Jun 2003 06:10 PM (UTC)
Message
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.

Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it!
Top

Posted by Banon   (2 posts)  Bio
Date Reply #3 on Mon 02 Jun 2003 08:19 PM (UTC)
Message
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 :)
Top

Posted by Gore   (207 posts)  Bio
Date Reply #4 on Tue 24 Jun 2003 11:07 PM (UTC)
Message
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*
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #5 on Wed 25 Jun 2003 05:23 AM (UTC)
Message
%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".


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


21,499 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.