[Solved]How do I - Math - How do I do Percentages?

Just started using Construct 2? Post your questions here

Post » Thu Jul 30, 2015 12:31 am

Hello community, I am bad at math!

I remember from when I was in school, it was something something 100 over a number? Haha, that's irrelevant right now...

Basically, uh. How do I type into string percentages?

How do I get the system to evaluate a number and give me the closest percent to that, and then of course "round" up or down?

I'm reading https://www.scirra.com/manual/126/system-expressions and also viewtopic.php?t=72716&start=0 as I wait for one of you lovely people to save me from my ineptitude of all things math.

Final question, what is the difference between the "Beginner's Questions" and "How do I" forum?
Last edited by SwatHound on Thu Jul 30, 2015 6:53 am, edited 1 time in total.
B
6
S
2
Posts: 60
Reputation: 1,242

Post » Thu Jul 30, 2015 4:11 am

Percent means "per one hundred" so it is value/possible then * 100. So if you have 5 apples out of a possible 7, that's 5/7*100 = 71.4%

In C2 you can use the 'round' expression to round to the nearest integer (whole number). so round(5/7*100) would give you 71. If you want it to have the % symbol, just use &

So:

On Action---Set Text to round(5/7*100) & "%"

Will set the text of a text object to 71%.

Also, How Do I is generally (to me) for more in-depth questions whereas Beginnger's Questions is simpler questions for people starting out with C2.
B
103
S
38
G
19
Posts: 962
Reputation: 17,986

Post » Thu Jul 30, 2015 6:53 am

Woah. Thank you kindly @C-7 , I got my answer in another post, but this one definitely helped me understand it deeper.

And thanks for answering my difference between question.
B
6
S
2
Posts: 60
Reputation: 1,242


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest