About Us
Products
Purchase
Downloads
Support
Forums
Contact Us
Site
 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
Duindain
Novice


Joined: 14 Feb 2003
Posts: 31
Location: Perth, Australia

PostPosted: Mon Jan 05, 2004 10:37 pm   

logic error or not enough sleep?
 
i have this trigger
pattern:
(%d)hp (%d)m (%d)mv>
value:
dumana = @duinmana/@duinmaxmana*100
#IF (@dumana <= 50) {
maname = duindain
c 'mana' @maname
}
lumana = @luewmana/@luewmaxmana*100
#IF (@lumana <= 50) {
maname = luew
c 'mana' @maname
}
ok the values change alot but what im testing it at is full mana for both chars the numbers all pass thru fine this is the values each formula has
dumana = @duinmana/@duinmaxmana*100
dumana=6631/6631*100
lumana = @luewmana/@luewmaxmana*100
lumana=4444/4444*100
now both of these results should provide 100 as result the if statement for the first char
#IF (@dumana <= 50) {
maname = duindain
c 'mana' @maname
}
works perfectly with those numbers it does not run which is the required result
however the second one runs constantly however as far as i can tell they are exactly the same with these numbers inputed anyway if i hover mouse over first if says =0 negative so thats right second says positive 1 and that is wrong what have i misplaced heh ive spent 20minutes trying to place the bits in different areas to fix it
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jan 05, 2004 11:34 pm   
 
@dumana is "6631/6631*100". This is a string so a string comparison is used. It's greater than the string "50" because the first character, "6", is greater than the first character "5".

@lumana is "4444/4444*100". This is also a string so another string comparison is done. It's less than the the string "50" because the first character, "4", is less than the first character "5".

If you want to do calculations when defining variables, either use the #MATH command or the %eval() function.
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