Page 1 of 1

How to access string text inserted as replacement for [var=xxx] in dialogue text?

Posted: Fri Apr 29, 2022 12:14 pm
by michaelheiml
Hi Toni,

I have a variable "mRaceDaysUntilSunday" which is e.g. "Two"
It's value is set by a script with DialogueLua.SetVariable("mRaceDaysUntilSunday", mRaceDaysUntilSunday);
The dialogue nodes' text is "[var=mRaceDayToday]"
During the dialogue, the user gets to a response panel, showing 3 choices, that have these dialogue texts':
1. [var=mRaceDayToday], e.g. "Two"
2. [var=mRaceDayWrong1], e.g. "Three"
3. [var=mRaceDayWrong2], e.g. "Four"
-> those response texts have to be dynamic because the answer changes depending on which day is today in real life.

Now, in the response menu, I have a button for each response choice that reads out loud what the response text says via speech synthesis.

And here is my problem: when accessing the responses' text, DSFU returns me e.g. "[var=mRaceDayToday]" (the variable placeholder) instead of the "real" text that the variable is replaced with (in my example e.g. "Two"). Of course I would need the actual value, not the variable name for speech synthesis (and typewriter rewrite effect) to work. I tried fetching the response text with
"string text = DialogueManager.masterDatabase.GetDialogueEntry(conversation.id, entry.id).responseButtonText;"
or other variables that are offered by GetDialogueEntry but with no luck.

How to I access the text that is inserted as replacement for the [var=xxx] ?

Thanks, Michael

Re: How to access string text inserted as replacement for [var=xxx] in dialogue text?

Posted: Fri Apr 29, 2022 2:42 pm
by Tony Li
Hi,

At what point, or in what method, are you kicking off the text-to-speech (TTS)? Are you sending the Response object's formattedText.text value to your TTS? The formattedText.text value is the text shown in the response button after processing all markup tags.

Re: How to access string text inserted as replacement for [var=xxx] in dialogue text?

Posted: Wed May 04, 2022 5:47 am
by michaelheiml
Hi Toni,

response.formattedText.text was the missing bit I needed, now it works (was using currentDialogueText instead which of course contains the variables).

As always - you are doing a great job in supporting, thanks!

Re: How to access string text inserted as replacement for [var=xxx] in dialogue text?

Posted: Wed May 04, 2022 11:11 am
by Tony Li
Glad to help!