User Tag List

Results 1 to 7 of 7

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

  1. #1
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Jan 2015
    Posts
    262
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    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) ?
    Attached files Attached files

  2. #2
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleHTML5 Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)

    Join Date
    Sep 2017
    Location
    Milano, Italy
    Posts
    130
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    You can use the Floor function to rount it down
    Floor(your expression)

  3. #3
    Clicker Android Export Module

    Join Date
    Feb 2010
    Posts
    130
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wrap the entire expression with floor(value)

  4. #4
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)iOS Export Module (Steam)

    Join Date
    Jan 2015
    Posts
    262
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Thank you. It works.

  5. #5
    Clicker Fusion 2.5 DeveloperHTML5 Export Module

    Join Date
    Jun 2006
    Posts
    1,461
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    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

  6. #6
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleSWF Export Module
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)

    Join Date
    Jul 2008
    Location
    United States
    Posts
    77
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Red face 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.

  7. #7
    Clicker Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Universal Windows Platform Export Module (Steam)
    Volnaiskra's Avatar
    Join Date
    Jan 2014
    Location
    www.sprykegame.com
    Posts
    2,163
    Mentioned
    78 Post(s)
    Tagged
    0 Thread(s)
    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.

Similar Threads

  1. Decimal point on counters problem
    By Ryan in forum SWF/Flash Export Module Version 2.0
    Replies: 2
    Last Post: 12th April 2012, 09:25 AM
  2. How to get the percentage of two counters?
    By Corlen in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 4th April 2012, 06:09 PM
  3. Cannot get percentage?
    By Dynamite in forum Multimedia Fusion 2 - Technical Support
    Replies: 18
    Last Post: 14th May 2010, 01:08 PM
  4. Percentage
    By dingdong in forum Multimedia Fusion 2 - Technical Support
    Replies: 7
    Last Post: 13th December 2006, 06:57 PM
  5. counters and decimal points.
    By Clicktastic in forum Multimedia Fusion 2 - Technical Support
    Replies: 1
    Last Post: 1st July 2006, 01:37 PM

Posting Permissions

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