 Thread: How to get the percentage of two counters without decimal ?

1. How to get the percentage of two counters without decimal ?

I need to find value Counter as a percentage of  Counter 2 value. Ive got three counters. Counter (my variable value) , Counter 2 ( This is my 100% value  its stable) , Counter 3 ( result in percentage ).

I used -> Set Counter to :

( value( "Counter" ) + 0.0 ) / ( value( "Counter 2" ) + 0.0 ) * 100

It works. But result is value with decimals. Is it possible to set Counter 3 without decimalas (only full figures) ?  Reply With Quote

2. You can use the Floor function to rount it down  Reply With Quote

3. Wrap the entire expression with floor(value)   Reply With Quote

4. Thank you. It works.  Reply With Quote

5. Do any of your counters ever go negative? Floor(value) could give you a problem.
Floor(-3.5) = -4 (moves away from zero)
Int(-3.5) = -3 (moves toward zero)

Does counter 2 ever go to 0 or 0.0? Could give you a divide-by-zero error  Reply With Quote

6. Thank you - very helpful.

Hi - Thank you for posting. I was having a lot of difficulty showing a percentage with decimals in an Android game. I was didiving to counter values and could not get a proper calculation. It used to work flawlessly in Clickn' Create and in Multimedia Fusion 2.0. I think they changed something in the counter code and messed up the handling of decimals. Anyway, this solves my problem. Thank you again.  Reply With Quote

7. If you need -3.5 to be -3 and 3.5 to be 3 then use int(). If you want - 3.5 to be -4 and 3.5 to be 4 then use round(). Floor() will give you - 4 and 3, as mentioned above.

And don't worry about dividing by zero. Fusion doesn't give errors for that. If an equation divides by zero, fusion just returns 0.  Reply With Quote Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•