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
373
S
218
G
84
Posts: 23,468
Reputation: 186,218

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: Google [Bot], Morcego, Per3za and 6 guests