Forum Discussion
BruceSilver
11 years agoCommunity Member
convert number variable to text
is it possible?
MarkW
8 years agoCommunity Member
Hi All,
I'm trying to change 30 separate number variables to 30 separate text variables. Do I need to repeat the javascript above 30 times, or is there a more elegant solution?
ZsoltOlah
8 years agoSuper Hero
Mark,
If you can name the number variables as Num1, Num2, Num3, Num4, and Text1, Text2, Text3, etc (it doesn't matter what the name is as long as you distinguish them by a number increasing from 1-30).
Then you can use this:
var player=GetPlayer();
var number = 0;
var text = "";
for (var i = 1; i<=30; i++)
{
number = player.GetVar("Num"+i);
text = number.toString();
player.SetVar("Text"+i, text);
}
- MarkWeingarten-8 years agoCommunity Member
Thanks, Zsolt! This is really helpful.
Related Content
- 9 months ago
- 9 months ago
- 9 months ago