A little help with a math issue

Discussion and feedback on Construct 2

Post » Sun Jun 14, 2015 6:18 pm

I need to calculate a value and I found some difficulty to create the right equation.

I would like to know the percent of the precision of clicks.

I have the number of the player's clicks and the number of hits. I believe that's correct if I divide them and multiply by 100, including &"%" after, isn't? I tried to use "round" to eliminate decimal numbers, but I didn't get the correct value?

Other doubt: How can I do to prevent "NaN (if player doesn't click in the screen)?

Thanks in advance
B
74
S
14
G
4
Posts: 1,051
Reputation: 8,207

Post » Sun Jun 14, 2015 6:53 pm

If Click_No > 0
-- PrecisionVar = int(100 * Hit_No / Click_No) & "%"
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,419
Reputation: 57,675

Post » Sun Jun 14, 2015 7:28 pm

The right way. Thank you, @Colludium
B
74
S
14
G
4
Posts: 1,051
Reputation: 8,207

Post » Sun Jun 14, 2015 8:25 pm

Any time :). Sometimes I have to leave my self-made problems for a day before I can return and try again.
Learning other engines, but C2 still rocks. Image Image Image Image
B
80
S
22
G
95
Posts: 2,419
Reputation: 57,675


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 1 guest