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
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Fri Aug 22, 2003 7:10 am   

Variable Evaluation assistance
 
What I'm trying to do is have a trigger that checks if the line before it ended in a blank space.

Here's and example of a few methods I've tried (and failed with) so far...
#TRIGGER {sample text here} {SpaceEvaluation=%line2;#IF (%ends(@SpaceEvaluation,%s)) {#SAY space} {#SAY no space}}

#TRIGGER {sample text here} {SpaceEvaluation=%line2;#IF (%ends(@SpaceEvaluation," ")) {#SAY space} {#SAY no space}}

#TRIGGER {sample text here} {SpaceEvaluation=%line2;#IF (%rightback(@SpaceEvaluation,1)=" ") {#SAY space} {#SAY no space}}


Unfortunately none of those worked, and I couldn't figure out any other methods to try. I just can't get it to recoginize and act on the blank space at the end of a variable. Any suggestions and help would be greately appreciated.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Aug 22, 2003 7:29 am   
 
#TRIGGER {%s$sample text here} {#SAY Got it?}
Reply with quote
Rugbystyle
Wanderer


Joined: 07 Oct 2001
Posts: 71

PostPosted: Fri Aug 22, 2003 7:46 am   
 
That works. However, I want the trigger to fire even when the line before it DOESN'T end in a white space. I want two different reactions, one for if it had a white space at the end, and one for if it did not. That's why I was trying to use an #IF statement evaluation of the %line2. So when I used that trigger, it would only fire if the line before it ended in a whitespace

So any help with an #IF statement evaluation of the variable, getting it to recognize a variable that ends in a whitespace?

Thanks, if anyone can help here.
Reply with quote
TonDiening
GURU


Joined: 26 Jul 2001
Posts: 1958
Location: Canada

PostPosted: Fri Aug 22, 2003 8:05 am   
 
How about then
#TRIGGER {(*)$sample text here} {#IF ("%1" = %trimright("%1")) {#SAY No Space} {#SAY Space}}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 22, 2003 6:43 pm   
 
And of course, there's always the two trigger solution.
#TR {%s$sample text here} {#SAY Space}
#TR {%x$sample text here} {#SAY No Space}
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