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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD Beta Forum
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Apr 28, 2008 2:50 pm   

[2.22] Comparison issue inside an ATCP trigger
 
I tried to make my Char.Vitals trigger smarter in the way it grabs my "to next level percentage" and stores it. My score shows the percentage down to the hundredth of a percent, but the ATCP message only shows the whole integer value. So, I only want to grab the value from the ATCP when it exceeds the integer portion of the currently stored value.

In other words, I check my score and I'm at 84.72% to the next level. I hunt for a while, not checking my score as I go, until I reach 85.01%. The ATCP message will send just 85%, and I compare that to 84% before setting my variable to 85.00%. (If I want better precision, I can check my score constantly, but I'm sure you see where I'm going with this simple plan.)

My trigger:
Code:
#REGEX {Char\.Vitals\12NL:(\d+)\/\d+ H:(\d+)\/(\d+) M:(\d+)\/(\d+) E:(\d+)\/(\d+) P:(\d+)\/10 N:(\d+)\/(\d+) W:(\d+)\/(\d+)} {
#IF (%2 > %int(@tonextlevel)) {
  tonextlevel = %1
}
health = %2
max_health = %3
mana = %4
max_mana = %5
ego = %6
max_ego = %7
power = %8
endurance = %9
max_endurance = %10
willpower = %11
max_willpower = %12
} "" {telnet|param=200}


It sets tonextlevel even when the ATCP number is lower than my currently stored number. I've tried various combinations of %int, %float, and using a local variable assigned %1, all to no avail.

Is this a bug?
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: Mon Apr 28, 2008 5:18 pm   
 
Well, isn't %2 your health and not the exp percentage? You are testing %2 in the #IF statement instead of %1.

If that was just a typo and it still doesn't work, try creating it as a normal trigger and play with the data that you send it to see what the problem might be.
Reply with quote
Larkin
Wizard


Joined: 25 Mar 2003
Posts: 1113
Location: USA

PostPosted: Mon Apr 28, 2008 6:05 pm   
 
Apparently, I need to do less yardwork and get more sleep. Thanks for pointing out the obvious for me to find. Embarassed


(Reason I didn't find this sooner is because it never works when I put #SAY in the script for an ATCP trigger, though that's what the help file tells us to do...)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD Beta Forum 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