Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: cleave on May 01, 2018, 12:26:45 PM

Title: question about floats [SOLVED]
Post by: cleave on May 01, 2018, 12:26:45 PM
How could I convert a float to percentage format,then display in the text?

For example, I got math results for floats like 0.5 1.5

I would like to display like this, 0.5 = 50% 1.5 = 150%

is there any actions to realized this?
Title: Re: question about floats
Post by: djaydino on May 01, 2018, 05:47:23 PM
Hi,
1st thing that comes in my mind is to do something like this :
use a 'float operator' and multiply by 100 (and save in a different variable),
Then 'convert float to string' (and set format 0 so you won't display anything behind the .)
Then 'build string' with 2 parts.
in part 1 (Element 0) set the string variable from the converted float.
in part 2 (Element 1) set %
and store in a variable.

Then you can use that to display the value.
Title: Re: question about floats
Post by: cleave on May 02, 2018, 05:33:55 AM
Thanks a lot
Title: Re: question about floats
Post by: djaydino on May 02, 2018, 01:37:26 PM
Hi.
Happy to help  :)
Title: Re: question about floats
Post by: beowulfkaine on June 13, 2022, 09:04:19 PM
Thanks this was exactly what I needed!


Hi,
1st thing that comes in my mind is to do something like this :
use a 'float operator' and multiply by 100 (and save in a different variable),
Then 'convert float to string' (and set format 0 so you won't display anything behind the .)
Then 'build string' with 2 parts.
in part 1 (Element 0) set the string variable from the converted float.
in part 2 (Element 1) set %
and store in a variable.

Then you can use that to display the value.