Page 1 of 1

Possible to set a numeric variable in a text variable?

Posted: Fri Dec 30, 2022 8:55 pm
by domopuff
Hi Tony,

I have a question.
I am trying to set a numeric variable "Generators.GeneratorsActivated" in a text variable "Player.HelperText" in the sequencer.

This is my current syntax:

Code: Select all

SetVariable(Player.HelperText, Variable["Generators.GeneratorsActivated"]/5 generators installed.);
SetTMPUI(HelperText,Player.HelperText);
AnimatorTrigger(Trigger,HelperText);
However, it prints the whole text instead of reflecting the actual number. I wanted to ask for your advice if there's a way around this. Thanks!

Re: Possible to set a numeric variable in a text variable?

Posted: Fri Dec 30, 2022 9:32 pm
by Tony Li
You could use a [var=variable] markup tag in the Sequence like this:

Code: Select all

SetVariable(Player.HelperText, [var=Generators.GeneratorsActivated]/5 generators installed.);
But I recommend using the Script field to set the variable instead:

Code: Select all

Variable["Player.HelperText"] = Variable["Generators.GeneratorsActivated"] .. "/5 generators installed."

Re: Possible to set a numeric variable in a text variable?

Posted: Sun Jan 01, 2023 1:55 am
by domopuff
Thanks for this. It worked!

Re: Possible to set a numeric variable in a text variable?

Posted: Sun Jan 01, 2023 8:21 am
by Tony Li
Glad to help!