The Daily Click ::. Forums ::. Klik Coding Help ::. adding percentage
 

Post Reply  Post Oekaki 
 

Posted By Message

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
28th May, 2009 at 13:37:27 -

I have this problem. I added bonuses in terms like +25% speed or damage or whatever. And i don't know if i am doing something wrong r the mmf.

Basicly this is the event.

(counter1+counter2-counter3)*(100+counter4)/100

and it doesn't work, i tried in an empty app this: 100*(100+10)/100 and doesnt work. why??? help.

 
Code me a sausage!

X_Sheep

I had a custom rating before it was cool

Registered
  01/03/2004
Points
  1313

VIP MemberPicture Me This -Round 23- Winner!Dos Rules!
28th May, 2009 at 14:30:08 -

Try dividing by 100.0 instead of 100, so MMF knows to use floats instead of integers.

 
a/n

Don Luciano

Heavy combat pancake

Registered
  25/10/2006
Points
  380

VIP Member
28th May, 2009 at 14:56:47 -

Did, works. thanks so very much!

 
Code me a sausage!

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
29th May, 2009 at 02:52:31 -

Personally I prefer setting it to 0.0 + counter1 + ...

Because it converts the whole thing to double as soon as it sees the first decimal point. /100.0 works fine here, but plenty of other types of code where it becomes a bug you can't find.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click