How do I get this format: 12.33%

0 favourites
  • 4 posts
From the Asset Store
Original music compositions in the style of classic RPGs such as FFII-IV.
  • I'm doing a chart with 6 bars and I need to get this type of format: 12.33% besides that the sum of all the results must be 100%

    Expression I'm using: round(intResult/totalPoints)*100&"%"

    If the intResult is equal 12 and the totalPoints is 115, I'm getting 10% instead of 10.43%

    I also need to know how to detect the higher one and a tie.

  • if intResult = 12 and totalPoints = 115,

    round(intResult/totalPoints)*100&"%" should return "0 %"

    round(intResult/totalPoints*100)&"%" should return "10%"

    round(intResult/totalPoints*10000)/100&"%" should return "10.43%"

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • because you added round = which takes the nearest to the higher value or lower, and cuts it out, for example, if you have round(104.50) the result will be 104 ... if it will be round(104.51) the result its going to be 105 because it passed the half value.

    try using float

    float(x)
    Convert the integer or text x to a float (fractional number). If x is text, non-numeric characters are allowed after the number, but not before. For example float("3.1xx") returns 3.1, but float("xx3.1") returns 0.[/code:2adsyvh5]
    
    [code:2adsyvh5]round(x) Round x to the nearest whole number e.g. round(5.6) = 6[/code:2adsyvh5]
    
    check [url=https://www.scirra.com/manual/126/system-expressions]manual[/url]for more expressions
  • Thank you guys.

    MadSpy: It worked very well.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)