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
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Aug 06, 2004 3:55 am   

Comparison problem
 
Put this together from another script i saw on here somewhere:
Code:
#CLASS {autoheal}
#VAR canflee {0}
#TRIGGER {HP (%d)/(%d)} {
  #IF (%1 < 75 and @canflee=1) {
    canflee=0
    .seese
    sleep
    }
  #IF (%1 = %2 and @canflee=0) {
    canflee=1
    wake
    .wnwwn
    }
  } "" {nocr|prompt}
#CLASS 0
Woked like a charm, right up until i reached 1000hps. Why? cause this is how it is displayed:
HP 1,000/1000

As you can see, there's a comma in there.
Tried to a few other ways, but nothing worked.
Granted, i can prolly get rid of the = comparison but making a timer, but was wanting something that would work no matter how much HP i had rather than need to adjust it when the timer is to short for a full heal.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Aug 06, 2004 4:41 am   
 
%n matches numbers which include commas, and also removes the commas.

#CLASS {autoheal}
#VAR canflee {0}
#TRIGGER {HP (%n)/(%n)} {
#IF (%1 < 75 and @canflee=1) {
canflee=0
.seese
sleep
}
#IF (%1 = %2 and @canflee=0) {
canflee=1
wake
.wnwwn
}
} "" {nocr|prompt}
#CLASS 0
_________________
LightBulb
Senior member

Most scripts in this forum are written for Command Line entry.
Don't even open the Settings Editor unless its use is specified or obvious.
Reply with quote
DeathDealer
Adept


Joined: 20 Jul 2004
Posts: 268

PostPosted: Fri Aug 06, 2004 4:46 am   
 
Thanks LB, was just about to say I found the solution in another post when i saw your answer :-)
Now, I just hope i remember it days from now when it comes up again :-)
_________________
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