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
Posts: 14
Reputation: 478

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
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Apr 18, 2012 2:48 am

Smashing! Works perfectly! Thanks a thousand!
B
6
Posts: 14
Reputation: 478


Return to How do I....?

Who is online

Users browsing this forum: chcteacher, Televangelist, Yahoo [Bot] and 24 guests