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
coamenel
Newbie


Joined: 31 Aug 2005
Posts: 7

PostPosted: Wed Aug 31, 2005 1:26 pm   

help with triggers using white space before numeric value
 
Hi,

I'm having some troubles creating triggers to keep track of my herbs.
They are used to update the values of some variables. Whenever i check my rift, the screen would look something like this:
Code:

[1367] bayberry bark [  16] bellwort flower [ 117] black cohosh

To capture the numeric values, I've tried the following triggers:
Quote:

~[&%dcohosh~] black cohosh
~[%s&%dcohosh~] black cohosh

Since some fields are started with one or more spaces, I prefer the second one. However, for fields like the bayberry above. The %s is too much, %d only captures the last number then.

Is there any way to solve this problem?

Thanks in advance!
Reply with quote
Guinn
Wizard


Joined: 03 Mar 2001
Posts: 1127
Location: London

PostPosted: Wed Aug 31, 2005 2:14 pm   
 
try using
{|%s}
rather than just %s

That will match anything with any number of spaces or no spaces

so
~[{|%s}&%dcohosh~] black cohosh
Reply with quote
coamenel
Newbie


Joined: 31 Aug 2005
Posts: 7

PostPosted: Fri Sep 02, 2005 6:42 am   
 
Didn't think of that one.. thanks for the suggestion!

However, i doesn't seem to work. Within my alias i get the following error:
Quote:

#TRIGGER {~[{|%s}&%dcohosh~] black cohosh} {} concoctions
^ syntax error
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Fri Sep 02, 2005 9:02 am   
 
I edited your post to use code tags instead of quote so we could see the actual spacing. Since they all have 4 spaces I would suggest using a fixed width pattern.
#TRIGGER {~[(&4)~] black cohosh} {#VARIABLE cohosh {%trim("%1")}} concoctions
_________________
The only good questions are the ones we have never answered before.
Search the Forums
Reply with quote
coamenel
Newbie


Joined: 31 Aug 2005
Posts: 7

PostPosted: Fri Sep 02, 2005 9:19 am   
 
works like a charm!

thanks!

I was fooling around with the &nn thingie, but wasn't able to get it to work. Now i've got a working trigger AND i know how to use &nn!!
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