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


Joined: 29 Nov 2008
Posts: 20

PostPosted: Mon Dec 01, 2008 9:43 pm   

Wildcards
 
What kind of wildcard should I use when I need to ignore certain things in reflexes?

Eyes gleaming, Narntuk strikes at you with a long, crimson scimitar.

The pattern I've used in Zmud is:

Eyes gleaming, (%w) {strikes|hacks|swings} at you with {a|an}*.

After 'strikes/hacks/swings at you with a/an', the text afterwards can be anything, ranging from different colour weapons to even mutilated bodyparts. Is using the aterisk fine for using it as a wildcard??

Thanks!
Reply with quote
MattLofton
GURU


Joined: 23 Dec 2000
Posts: 4834
Location: USA

PostPosted: Mon Dec 01, 2008 9:53 pm   
 
Depends on what you know about the stuff the wildcard needs to represent and how similar the line is to elsewhere in the game messaging. * is fine if you don't care or cannot distinguish the stuff you want to match from stuff you don't want to match, but it is the broadest and therefore the most dangerous wildcard to use.

Keep in mind that we probably don't play your game and likely aren't having to deal with your formatting realities, so the more specific you can get about what will appear the more complex and targeted we can make the wildcards.
_________________
EDIT: I didn't like my old signature
Reply with quote
mikeC130
Apprentice


Joined: 03 Jul 2006
Posts: 110

PostPosted: Tue Dec 02, 2008 3:37 am   
 
Also, if you don't want to capture the trailing text for use in the script, you can leave out the * entirely, unless you need to make sure that the period is in there. Note that without an end marker ($), the period in this case is not necessarily the end of the line. Eliminating the * should speed up your script if you don't need to process the remaining text.

Mike
Reply with quote
Fang Xianfu
GURU


Joined: 26 Jan 2004
Posts: 5155
Location: United Kingdom

PostPosted: Tue Dec 02, 2008 9:57 am   
 
It won't actually be that much slower because the wildcard is greedy, but yes, it's not needed. Just get rid of the *. entirely.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
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