GetDialogueEntry does not run Lua commands

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
kheper
Posts: 5
Joined: Fri Aug 07, 2020 1:22 pm

GetDialogueEntry does not run Lua commands

Post by kheper »

I am using text from the Dialogue System in my UI so am manually accessing the database as follows:

Code: Select all

Conversation con = DialogueManager.masterDatabase.GetConversation(convoRef);
DialogueEntry ent = con.GetDialogueEntry(i+1);
reflectLabel[i].text = ent.DialogueText;
This was working great until I put a Lua command in the text '[var=mcName]'. Now the displayed text just shows the '[var=mcName]' instead of the name. I tried doing Lua.Run but that seems to require the command be isolated with no text.

So what is the best method to run all inline lua commands on a provided string file? Or is there a way to get the processed string directly from the DialogueManager?
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: GetDialogueEntry does not run Lua commands

Post by Tony Li »

Hi,

Use FormattedText.Parse:

Code: Select all

reflectLabel[i].text = FormattedText.Parse(ent.DialogueText);
kheper
Posts: 5
Joined: Fri Aug 07, 2020 1:22 pm

Re: GetDialogueEntry does not run Lua commands

Post by kheper »

Thanks! That works. I knew there would be an easy solution just couldn't find in all the documentation.
User avatar
Tony Li
Posts: 22050
Joined: Thu Jul 18, 2013 1:27 pm

Re: GetDialogueEntry does not run Lua commands

Post by Tony Li »

Glad to help!
Post Reply