Possible to set a numeric variable in a text variable?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
domopuff
Posts: 22
Joined: Fri May 13, 2022 2:26 am

Possible to set a numeric variable in a text variable?

Post 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!
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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."
domopuff
Posts: 22
Joined: Fri May 13, 2022 2:26 am

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

Post by domopuff »

Thanks for this. It worked!
User avatar
Tony Li
Posts: 21636
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad to help!
Post Reply