Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Lokke11
Beginner


Joined: 27 Apr 2007
Posts: 16

PostPosted: Thu Sep 11, 2014 6:12 am   

Trigger Help!
 
I am having a problem with my trigger. What I have deduced is that when the Pattern comes in with a Very Good in the stats the #If command is counting as both the =Good and =Very Good which throw's off my Count Variable.

Pattern: Agility:(%s)&Agi Wisdom:(%s)&Wis

#if (@agi =~ "Good") {#add Count 1}
#if (@agi =~ "Very Good") {#add Count 2}
#if (@agi =~ "Excellent") {#add count 3}
#if (@wis =~ "Good") {#add count 1}
#if (@wis =~ "Very Good") {#add count 2}
#if (@wis =~ "Excellent") {#add count 3}

EXAMPLE:
Agility: Very Good Wisdom: Good

This will make my @count total 4, when it should be totaling 3. (2 for Very Good, 1 for Good)

Any Advice anyone?
Reply with quote
rozdwojeniejazni
Wanderer


Joined: 13 Aug 2011
Posts: 74

PostPosted: Thu Sep 11, 2014 7:07 am   
 
Are you aware that =~ operator means pattern matching - not string comparison? Of course the string "Very Good" matches the pattern "Good".

Use = or == instead, as these mean exact string comparing.
Reply with quote
Lokke11
Beginner


Joined: 27 Apr 2007
Posts: 16

PostPosted: Thu Sep 11, 2014 3:34 pm   
 
Awesome. Thanks for the fix. Learned something new!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD 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