Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: Wed Jan 29, 2003 6:28 pm   

wildcards in patterns using |
 
"You kick (*) with all might" works well as pattern, as does "You take the last laugh kicking".
however if you combine them using |, like:
{You kick (*) with all might|You take the last laugh kicking}
it messes up.
the problem seem to be any wildcards in patterns. any idea what can be done to make it work?
Reply with quote
Evangelist
Adept


Joined: 10 Oct 2000
Posts: 224
Location: USA

PostPosted: Wed Jan 29, 2003 6:42 pm   
 
have you tried.

{You kick &kicktarget with all might|You take the last laugh kicking}

Granted, you may not need the kicktarget variable, but it may work instead of a wildcard


Evangelist/Pernius
telnet://phidar.com:9000
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Jan 29, 2003 6:52 pm   
 
The solution is really quite simple.
#TR {You kick (*) with all might} {#SAY This has a ~%1, which is %1.}
#TR {You take the last laugh kicking} {#SAY This doesn't have a ~%1.}

That's right, just use two triggers.

From what I've heard (I haven't bothered testing it), wildcards don't work inside stringlists. I also haven't tested putting different numbers of parameters in stringlists, but I'd expect that to fail every time also.

LightBulb
Senior Member
Reply with quote
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: Wed Jan 29, 2003 6:53 pm   
 
unfortunately that doesn't work either...i used the "test trigger" option, and it accepts "You kick &kicktarget with all might", but not "You kick testmob with all might"
Reply with quote
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: Wed Jan 29, 2003 6:58 pm   
 
yes, making two triggers does work, but that's what i want to avoid. in this case i want to have the same "value" to over 20 different "patterns". i would need to change >20 triggers each time i correct something in the value. if there is no other way, i will do just that though, thanks for your replies :)
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Wed Jan 29, 2003 8:10 pm   
 
Like LightBulb said, wildcards aren't allowed inside {}'s in the pattern. You have two options: use patterns that are a bit more creative, or make multiple triggers.

With the creative patterns method you can do:
#TRIGGER {You {kick|take the last} (*) {with all might|kicking}} {commands}

I'm not sure if you'd really want the text matched by * saved to %1 in this case since it may either be whatever comes between "kick" and "with" in the first message or the word "laugh" in the second message. This would not be so much of a problem if it weren't for the fact that figuring out which of the two lines was the one that fired the trigger would be more complex than simply splitting the triggers in two.

For the multiple triggers method, you may create an alias if you want to only update common code once and in one place:
#ALIAS myAlias {commands}
#TRIGGER {You kick (*) with all might} {myAlias}
#TRIGGER {You take the last laugh kicking} {myAlias}

Kjata
Reply with quote
kymon
Novice


Joined: 29 Jan 2003
Posts: 40

PostPosted: Wed Jan 29, 2003 8:45 pm   
 
I will do the multiple triggers with alias method, though i realy like the idea of "creative patterns". thanks lots!!!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net