Calculations in MMF2 code - It's not working, help
Hi.
So basically I'm trying to do a simple hit accuracy for my game (Bullets hit*100/Bullets fired) This works fine in a usual calculator, but for some reason it doesn't work in MMF2, it just seems to say 0 all the time, no matter what.
I also have problems like this with other calculations such as ratios.
Please help I cannot find the problem!
Re: Calculations in MMF2 code - It's not working, help
Please don't post questions like this here. Post them in "Multimedia Fusion 2 - Technical Support".
Replace the 100 by 100.0 - that way MMF will use floating point calculations. :)
Re: Calculations in MMF2 code - It's not working, help
Thanks! it worked! but how do I get rid of the decimals? for example, 678*100.0/1000=67.8
How do I get rid of the .8? then I will be able to make 67% hit accuracy :) thanks again Looki :D
Oh yeah and sorry for posting this here, I will in future ;) I'm new here.
Re: Calculations in MMF2 code - It's not working, help
You can use floor(67.8) to round down and get 67.
ceil(67.8) rounds up and gets 68.
If you want to round to the closest integer, use round.
round(67.8) would return 68 since .8 is >= .5
round(67.2) would return 67.
Re: Calculations in MMF2 code - It's not working, help
Wait, I thought MMF2 only had floor()?
Re: Calculations in MMF2 code - It's not working, help
Re: Calculations in MMF2 code - It's not working, help
Why would MMF2 only have Floor()? :crazy:
Re: Calculations in MMF2 code - It's not working, help
Because Ceil() is the same as Floor()+1? And you could make conditions for rounding. I guess I just mis-read somwhere. Plus, look at this:
http://www.LB-Stuff.com/MMF2/NoCeil.png
How the heck am I suppost to know something exists if it's not referenced anywhere, not even in the help?
Re: Calculations in MMF2 code - It's not working, help
Re: Calculations in MMF2 code - It's not working, help
Um, ok that's just wierd. Sometimes MMF2 glitches up if my computer has been on too long. I'll see if restarting helps.