Page 1 of 1

dialogue history

Posted: Thu Oct 20, 2022 7:25 am
by joeylu
I'm trying to add an UI to display all the dialogue history, I can manually iterate the conversations and display everything, that's not a problem, just curious if there are any built-in methods to get histories, tks

Re: dialogue history

Posted: Thu Oct 20, 2022 8:02 am
by Tony Li
Hi,

Please see this example.

Re: dialogue history

Posted: Thu Oct 20, 2022 11:39 am
by joeylu
tks Tony, the example seems that is using OnConversationLine to build up a <Subtitle> list and use DialogueManager.instance.PlaySequence to play the subtitle.
Any idea that I can save the subtitle list so when player reload the game and still get the dialogue log history? should I save the complete subtitle list or maybe just the id and retrieve it back after loading?

Re: dialogue history

Posted: Thu Oct 20, 2022 12:11 pm
by Tony Li
I recommend saving a list of <conversationID, dialogueEntryID> pairs. This way if your conversation uses cross-conversation links you'll know which conversation to get the dialogue entry from.

Alternatively, if you do text substitution in your dialogue text, you might want to save the actual text from each line's Subtitle.formattedText.text.

Re: dialogue history

Posted: Fri Oct 21, 2022 2:23 am
by joeylu
in summary, gathering a list of <conversationID, dialogueEntryID> pair and save it
when reloaded, use DialogueSystem built-in methods to retrieve the actual dialogue title/description, actors in my dialogue history UI
ps. I don't have any text substitution so don't need to worry about that

Re: dialogue history

Posted: Fri Oct 21, 2022 8:10 am
by Tony Li
Yup! For future readers who haven't looked up the method to get a dialogue entry, it's:

DialogueManager.masterDatabase.GetDialogueEntry(conversationID, entryID)

Then you can get the dialogue text and run it through FormattedText.Parse() to handle any special formatting codes such as emphasis markup tags.

Example:

Code: Select all

DialogueEntry entry = DialogueManager.masterDatabase.GetDialogueEntry(conversationID, entryID);
string text = FormattedText.Parse(entry.DialogueText);

Re: dialogue history

Posted: Sat Oct 22, 2022 6:17 am
by joeylu
thank you tony, again!

Re: dialogue history

Posted: Sat Oct 22, 2022 8:46 am
by Tony Li
Glad to help!