playMaker

Author Topic: question about floats [SOLVED]  (Read 1852 times)

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
question about floats [SOLVED]
« 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?
« Last Edit: May 02, 2018, 01:37:40 PM by djaydino »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: question about floats
« Reply #1 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.

cleave

  • Playmaker Newbie
  • *
  • Posts: 27
Re: question about floats
« Reply #2 on: May 02, 2018, 05:33:55 AM »
Thanks a lot

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: question about floats
« Reply #3 on: May 02, 2018, 01:37:26 PM »
Hi.
Happy to help  :)

beowulfkaine

  • Playmaker Newbie
  • *
  • Posts: 47
Re: question about floats
« Reply #4 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.