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
jofu
Beginner


Joined: 02 Nov 2003
Posts: 12
Location: USA

PostPosted: Mon Mar 22, 2004 6:54 am   

#IF with =~ pattern expression
 
If I have a %1 captured from a trigger which could look like this Apprentice Timmy, the great But it could also be virtually anything else. And I want a #IF to evaluate to true if Apprentice is in it, why isn't #IF (%1 =~ "Apprentice") {do stuff} working? Am I misunderstanding the use of patterns in expressions?
Reply with quote
Mumra
Wanderer


Joined: 12 Feb 2003
Posts: 93
Location: USA

PostPosted: Mon Mar 22, 2004 12:57 pm   
 
Now, I'm not a zmud guru, but it is probably possible to do something to the
effect of what you want, but If all you are trying to do is see if someone is an
Apprentice, couldn't you just use something like this?
#TR {Apprentice (%w),} {dotruestuff} {dofallstuff}
And accomplish the same thing?
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Mar 22, 2004 3:17 pm   
 
If your trigger pattern is basically (*), try using quotes around your %1 to compare the entire string correctly.

#TRIGGER {(*)} {#IF ("%1" =~ "Apprentice") {do stuff}}

I'm sure that what you're doing is a bit different, but hopefully this helps.
Reply with quote
jofu
Beginner


Joined: 02 Nov 2003
Posts: 12
Location: USA

PostPosted: Mon Mar 22, 2004 9:55 pm   
 
quote:
Originally posted by Larkin

If your trigger pattern is basically (*), try using quotes around your %1 to compare the entire string correctly.

#TRIGGER {(*)} {#IF ("%1" =~ "Apprentice") {do stuff}}

I'm sure that what you're doing is a bit different, but hopefully this helps.



That was exactly it, quotes around the variable, just like a shell script *grin* thank you!
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