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 ➜ General ➜ "Optional" Wildcard in Alias

"Optional" Wildcard in Alias

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


Posted by Corwindio   (2 posts)  Bio
Date Mon 01 Oct 2007 07:26 PM (UTC)
Message
I'm having a bit of trouble trying to create an alias that will omit the wildcard from the alias if I don't specify one. To be more specific, this is the alias I've used in the past through MCL:

tgp %1 (tgp * for MUSHclient)

open pouch
take %1 gold from pouch
close pouch

Behavior one usually ends up like this:

tgp 100

open pouch
take 100 gold from pouch
close pouch

HOWEVER, I want behavior two to happen like this when I don't specify %1:

tgp

open pouch
take gold from pouch (This takes all gold from the pouch)
close pouch

It seems that if I check "Regular Expression" in the alias editing dialog, it doesn't let me use the wildcard, period (Behavior two). However, if I don't have that checked and I just send "tgp" without the added wildcard, the client doesn't recognize the command (only behavior one works)

I hope I've made my issue clear, but I'll be more than willing to help you better understand if that didn't do it.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Mon 01 Oct 2007 11:07 PM (UTC)
Message
One approach would be to use:

tgp*

That way you aren't insisting on the space after "tgp" and that should match both cases.

Otherwise, you could use regular expressions:


Match: ^tgp( [0-9]+){0,1}$


This checks for a space followed by some numbers.

- Nick Gammon

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

Posted by Corwindio   (2 posts)  Bio
Date Reply #2 on Wed 03 Oct 2007 09:40 PM (UTC)
Message
Brilliant fix, Nick. The xxx* formula did exactly what I wanted it to. Thanks a lot!
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.


15,014 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.