User Tag List

Results 1 to 7 of 7

Thread: Percentages?

  1. #1
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Percentages?

    Hello, I'm making a game and I want to show the percent of your hp, like 56% of hp left or something like that, but MMF2 doesn't seem to like decimals. Right now I'm doing this for the equation, which only works when the value is 100%:

    value( "hp" )/maxvalue( "hp" )*100)

    Is there a different equation I could use? An extension? Thanks

  2. #2
    No Products Registered

    Join Date
    Oct 2006
    Location
    Sweden
    Posts
    1,141
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    Try forcing MMF to use decimals like: value( "hp" )/(maxvalue( "hp" )*100.0)

  3. #3
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    Thanks, it worked! One more question, how would i make it round to the hundredths place? The Round() function rounds to the nearest whole number.



  4. #4
    Clicker Multimedia Fusion 2 DeveloperSWF Export Module

    Join Date
    Jul 2006
    Location
    Pittsburgh, PA, USA
    Posts
    777
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    Multiply it by 100, round it, and then divide it by 100.

    Try this:
    Round(value( "hp" )/(maxvalue( "hp" )*100.0)*100)/100

    Wow! That's a lot of 100's!!!

  5. #5
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    Hmmm... that should work but for some reason it doesn't. Heres what I have:
    The original:
    value( "exp" )/(maxvalue( "exp" )*1.0)*100
    With the thing:
    Round((value( "exp" )/(maxvalue( "exp" )*1.0)*100 )*100)/100

    But it still displays as a whole number(9, 100, 50, etc.) instead of 9.54, 100.00, 50.45 etc.

    EDIT:
    Nevermind, If I don't divide it by 100 at the end it works! Thanks for the help. Now I have to find a way to stick a . in there...

  6. #6
    No Products Registered

    Join Date
    May 2008
    Location
    California
    Posts
    81
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    Ok, I got the decimal in there, using this:

    Str$(value( "exp" )/(maxvalue( "exp" )*1.0)*100)+"."+Str$(Round(((value( "exp" )/(maxvalue( "exp" )*1.0)*100)*100)-(value( "exp" )/(maxvalue( "exp" )*1.0)*100)))

    BUT the digits after the decimal wont round..


    Edit: Ah well, for now I'll just change the size of the string so the extra digits wont be seen.

  7. #7
    Clicker Multimedia Fusion 2 Developer

    Join Date
    Jun 2006
    Location
    Darlington, UK
    Posts
    3,298
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Percentages?

    str$( round( value( "exp" ) * 100 * 100.0 / maxvalue( "exp" ) ) / 100.0 )

    Should do it, including putting in the "." and two decimal places

    EDIT: though as 1/100 is a recurring number in binary, you may not end up with only two places

Similar Threads

  1. Win/Loss Bars, Percentages Problems
    By Verbage in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 20th March 2012, 03:36 PM
  2. Place objects by percentages
    By wizlore in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 16th December 2011, 04:34 PM
  3. Percentages %
    By Hordolur in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 14th April 2009, 07:54 AM
  4. How do I do percentages?
    By Cossin in forum Multimedia Fusion 2 - Technical Support
    Replies: 3
    Last Post: 13th September 2008, 11:09 PM
  5. Percentages
    By Strider in forum Multimedia Fusion 2 - Technical Support
    Replies: 2
    Last Post: 29th January 2007, 12:31 AM

Posting Permissions

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