Negative decimal number

Get help using Construct 2

Post » Wed Apr 18, 2012 1:44 am

I've been trying to get a number to display a negative decimal number correctly and so far this is what I have:

"ATK: "& int(Player.P_ATK_Bonus) & "." & int(Player.P_ATK_Bonus*100)%100

It would display a number as "ATK: -2.-11" and it should be "ATK: -2.11". Thanks for reading.
B
6
S
1
Posts: 14
Reputation: 628

Post » Wed Apr 18, 2012 1:59 am

Try:

"ATK: "& int(Player.P_ATK_Bonus) & "." & int(abs(Player.P_ATK_Bonus)*100)%100
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Wed Apr 18, 2012 2:48 am

Smashing! Works perfectly! Thanks a thousand!
B
6
S
1
Posts: 14
Reputation: 628


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests