"Optional" Wildcard in Alias

Posted by Corwindio on Mon 01 Oct 2007 07:26 PM — 3 posts, 15,638 views.

#0
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.
Australia Forum Administrator #1
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.
#2
Brilliant fix, Nick. The xxx* formula did exactly what I wanted it to. Thanks a lot!