Limiting attribute value printed to screen?

Long story short.
I'm writing a guy in the army. Everything he's carrying has a weight (displayed as "Carrying ! kilo").
I went a bit overboard with the whole thing and now every time he fires his pistol his total weight drop approx 0.01 kilo.
Everything is working but if I empty the gun, reload it from the box of ammo I'm carrying and repeat the process; if I decide to "drop ammo" this gets displayed:

CARRYING: 0.950000000000001 KG

I know this whole thing might be a bit overkill and all but I sort of like it.
However... I'd like for the status to show

CARRYING: 0.95 KG

So... the question: Is there a way to make the game print only the first 2 digits after the . ?


object.weight =  Round(object.weight, 2)

PS

If you'd like to make your parser understand profanity, message me!


object.weight = Round(object.weight, 2)

That was simple enough. Thanks a lot!
Only one question....
Where do I... you know... actually put that code?


And, of course, I've sent you a message regarding that other thing :)


I'd probably that to script when firing the pistol.

pistol.weight =  Round(object.weight, 2)

...or wherever you decrease the weight.


Ah, of course. I'll blame it on the fever =)
Thanks K.V.!


Fevers suck. (They make me do dumb stuff (or dumber-than-usual stuff).)


Log in to post a reply.

Support

Forums