dialogue history

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

dialogue history

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

Re: dialogue history

Post by Tony Li »

Hi,

Please see this example.
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: dialogue history

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

Re: dialogue history

Post 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.
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: dialogue history

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

Re: dialogue history

Post 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);
joeylu
Posts: 111
Joined: Sun May 17, 2020 1:07 pm

Re: dialogue history

Post by joeylu »

thank you tony, again!
User avatar
Tony Li
Posts: 21676
Joined: Thu Jul 18, 2013 1:27 pm

Re: dialogue history

Post by Tony Li »

Glad to help!
Post Reply