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

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
michaelheiml
Posts: 46
Joined: Thu Nov 08, 2018 5:47 am

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

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

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

Post 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.
michaelheiml
Posts: 46
Joined: Thu Nov 08, 2018 5:47 am

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

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

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

Post by Tony Li »

Glad to help!
Post Reply