16
Technical forum / Re: in-game money....
« on: March 13, 2014, 02:27:25 PM »
Excellent - item.AmountString works well 
I am tracking my $ and Cents as separate globals - so am dividing my Cents by 100 and adding that to the $.
However for $1.50 my maths calculation displays $1.500000. Is there a way I can keep decimal places to just 2 integers? And single integers if needed, e.g. $1.99 to $1.10 (2 integers) $1.9 to $1.1 (1 integer).
I couldn't see how to do that with the maths code.

I am tracking my $ and Cents as separate globals - so am dividing my Cents by 100 and adding that to the $.
Code: [Select]
var MoneyItem = Game.GetItem("money");
moneytotal = moneydollar + (moneycents/100);
MoneyItem.AmountString = moneytotal;
However for $1.50 my maths calculation displays $1.500000. Is there a way I can keep decimal places to just 2 integers? And single integers if needed, e.g. $1.99 to $1.10 (2 integers) $1.9 to $1.1 (1 integer).
I couldn't see how to do that with the maths code.