Page 1 of 1

converting to percent

PostPosted: Sat Jan 12, 2008 5:31 pm
by DarkParadox
how do you convert transperancy into a percent out of one hundred,
like 0.01 = 1% and 0.47 = 47%

Re: converting to percent

PostPosted: Sat Jan 12, 2008 5:41 pm
by Kalladdolf
yup, that's exactly it
0 = 0% and 1 = 100%

0.5 = 50 %
0.345 = 34.5 %

and so on =D

Re: converting to percent

PostPosted: Sat Jan 12, 2008 5:49 pm
by DarkParadox
it would be to long of a code, can you tell me how to make it shorter?

Re: converting to percent

PostPosted: Sat Jan 12, 2008 6:08 pm
by Kalladdolf
Code: Select all
var = transp*100;

so it'll just turn var into a basic number, there is no percent expression in the GE language.

Re: converting to percent

PostPosted: Tue Jan 29, 2008 1:51 pm
by DocRabbit
Here is a sample code that would do it. It is from my Health Bar demo, but the concept should work the same.
Code: Select all
sprintf(texthealth.text,"%d%%",Goober.health);


Replace Goober.health with your transparency increased *100 variable.