Page 1 of 1

Using references to actor display names in dialogue text when directly accessing dialogue entries

Posted: Fri Aug 04, 2023 7:21 am
by Loremu
Hi,

Information about my setup:
We are making a game with comics. All texts are stored in a conversation in the Dialogue Database. I am not using Dialogue System Trigger components to display the texts. Instead every comic panel has a reference to a certain dialogue entry. I use a custom script to display the panels which basically just replaces a TextMeshPro text with the text of the dialogue entry.

Code: Select all

DialogueEntry _entry = dialogueDatabase.GetDialogueEntry(conversation.id, comics[activeComic].panels[activePanel].dialogueEntryID);
        textMeshPro.text = _entry.subtitleText;
        
This works fine, also with localized texts (which is important as we need localization).

My issue
We are in the beginning of the writing process. It could happen that we have to replace some names later in development. Sometimes Characters mention each other. I want to be able to replace names easily in case something changes. So instead of writing the names in the dialogue text I am referencing their display name in the dialogue text like this:

So, what's [lua(Actor["Jennifer"].Display_Name)] doing?

My actor is called Jennifer, her display name is "Jenny".
When I am using the DialogueSystemTrigger component to display this text it writes:
So, what's Jenny doing?

However, when I directly access the entry.subtitle text as described above it writes:
So, what's [lua(Actor["Jennifer"].Display_Name)] doing?

I thought about running a check whether the string _entry.subtitleText contains [lua(Actor["respective actor's name"].Display_Name)], search for the actor, get their display name and then replace the lua expression with this name, store this in a new string and assign that new string to the textMeshPro.text.

But maybe there is an easier way to achieve being able to replace the names?

I appreciate any suggestions and tips :) Thank you!!

Best
Lorena

Re: Using references to actor display names in dialogue text when directly accessing dialogue entries

Posted: Fri Aug 04, 2023 9:11 am
by Tony Li
Hi Lorena,

Use:

Code: Select all

textMeshPro.text = FormattedText.Parse(_entry.subtitleText).text;
This will process all markup tags.

Re: Using references to actor display names in dialogue text when directly accessing dialogue entries

Posted: Mon Aug 07, 2023 4:28 am
by Loremu
Hi Toni,

works perfectly, thank you!

May I ask how many people are in the support team? You always answer so quickly and accurately, also to complex issues, so I was wondering if "Toni Li" is one person or the general "Pixelcrushers-support-account" that multiple team members use :D

Best
Lorena

Re: Using references to actor display names in dialogue text when directly accessing dialogue entries

Posted: Mon Aug 07, 2023 11:51 am
by Tony Li
The Internet has more than one Tony Li (one of them always beats me to usernames on social media ;) ), but I'm the only Tony Li in Pixel Crushers. I do my best to respond in a timely manner.

Re: Using references to actor display names in dialogue text when directly accessing dialogue entries

Posted: Tue Aug 08, 2023 6:43 am
by Loremu
Oh wow, I actually didn't expect that it's just one person doing all the support stuff. Kudos!
Thank you for your work! Get some sleep every now and then ;)