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
362
S
216
G
75
Posts: 23,064
Reputation: 180,315

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: alextro, pokka and 19 guests