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
cachew
Novice


Joined: 10 May 2001
Posts: 39
Location: USA

PostPosted: Wed Apr 23, 2008 4:30 pm   

Matching and exact # of spaces
 
How do you you match an exact number of spaces in a trigger?

Example:
Code:
var1  var2    var3


between var1 and var2 I would like to match, in a trigger, exactly 2 spaces and between var2 and var3 I would like to match exactly 4 spaces.

I have tried various permutations of &nn %w etc and I can't seem to get it.

thanks
_________________
Christopher Chew
Reply with quote
Rahab
Wizard


Joined: 22 Mar 2007
Posts: 2320

PostPosted: Wed Apr 23, 2008 4:59 pm   
 
Maybe I'm missing something here. To match an exact number of spaces, simply include the spaces in your trigger:

Code:

#trigger {var1  var2    var3} {#say success!}
#show {var1  var2    var3}


success!

hm. I thought quoting would retain the spaces. oh well. Try the above with the actual spacing you want.
Reply with quote
Fang Xianfu
GURU


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

PostPosted: Wed Apr 23, 2008 5:29 pm   
 
I edited both your messages to use the all-important code tag. Please try to remember, 007.

Anyway, Rahab's exactly right. Just put the spaces in and it'll match. Similarly, if you put too many spaces in, it'll stop a pattern from matching.
_________________
Rorso's syntax colouriser.

- Happy bunny is happy! (1/25)
Reply with quote
meyn
Beginner


Joined: 06 Mar 2008
Posts: 27

PostPosted: Wed Apr 23, 2008 5:41 pm   
 
In my mud i had the following trigger

#TR {(%w) is dead~! R~.I~.P~.} {}

there are 2 spaces before the R.I.P but zmud kept changing my trigger to only have 1 space, to get around this:

#TR {(%w) is dead~!(%s)R~.I~.P~.} {}

the (%s) matches anynumber of spaces, if you change your trigger to:

#TR {var1(%s)var2(%s)var3}

the pattern will now match all spaces

hope this helps
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