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


Joined: 04 Aug 2004
Posts: 82
Location: Philadelphia

PostPosted: Wed Aug 04, 2004 4:46 am   

Performing calculations in an #IF command
 
I'm trying to test a condition in an #IF command that checks to see if the price in a store is more than 10% less than a price stored in a variable. What I have is:

#IF (%2<@Price*.9) {Price=%2}

The .9 seems to be causing the condition to fail but I can't figure out why and I don't know how to fix it.

Help would be appreciated.
_________________
Erasmus
Reply with quote
jessew
Apprentice


Joined: 03 Mar 2003
Posts: 141

PostPosted: Wed Aug 04, 2004 6:23 am   
 
#IF (%2<@Price*%float(.9)) {Price=%2} should do it.


Cheers
_________________
I love deadlines. I like the whooshing sound they make as they fly by.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Wed Aug 04, 2004 2:57 pm   
 
It's also quite simple to modifiy the formula to use integers.
#IF (%2 < (@Price * 9)/10) {Price = %2}
_________________
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
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