I’m adding money to my game and It would make a lot of sense for it to be inplemented in a way where cents are available. e.g you can complete a small task for 1 cent.
The problem I am getting is that often instead of displaying 0.11 it will wither display 0.110000000000000
or 0.109999999999999999999.
Unfortunately, decimal explosions are common in many languages (they even happen in Excel, but you never notice them because of built in rounding). Since the field you are displaying the money in is a text field, you can use the following trick to force the value to behave:
The scene has 2 text fields - rawValue and adjValue.
The formula takes the dollarsAndCents value, adds 0.0001 giving a value of 1.01199999999
Multiplying by 100 changes the value to 101.1999999999
The Round function changes this to 101
then the division by 100 reverts the value to 1.01
Sorry for the delay in getting back you you @Scythe. I created a function and submitted it to GitHub for possible inclusion in the downloadable Extensions. It will take in a numeric value, round the decimals to 2 places, convert it to a string and format it to 2 decimal places.
Here is the configuration, code and usage of the function: