Hi there,
For debugging purposes, I'd like to store in a string variable the contents of the current dialogue entry.
That way I would be able to show on the next dialogue line what I've run in the previous one.
Is it possible?
Thank you.
Store dialogue entry sequence in a variable?
Store dialogue entry sequence in a variable?
Unity 2019.4.9f1
Dialogue System 2.2.15
Dialogue System 2.2.15
Re: Store dialogue entry sequence in a variable?
Hi,
You could get it from the subtitle panel's subtitle text UI element.
Or you could download this patch:
DS_PlayMakerPatch_2023-09-24.unitypackage
Then use a Dialogue System Events To PlayMaker component and listen for the OnConversationLine event. The patch above makes this event include the subtitle text as the string data connected to the event.
You could get it from the subtitle panel's subtitle text UI element.
Or you could download this patch:
DS_PlayMakerPatch_2023-09-24.unitypackage
Then use a Dialogue System Events To PlayMaker component and listen for the OnConversationLine event. The patch above makes this event include the subtitle text as the string data connected to the event.
Re: Store dialogue entry sequence in a variable?
Um... sorry. I've written some nonsense.
What I want to store are the contents of the Sequence...:
What I want to store are the contents of the Sequence...:
Unity 2019.4.9f1
Dialogue System 2.2.15
Dialogue System 2.2.15
Re: Store dialogue entry sequence in a variable?
Can you use a little C#? If so:
Or, in a script on the Dialogue Manager, you can add an OnConversationLine() method:
Code: Select all
string sequence = DialogueManager.currentConversationState.subtitle.sequence;
Code: Select all
void OnConversationLine(Subtitle subtitle)
{
string sequence = subtitle.sequence;
}
Re: Store dialogue entry sequence in a variable?
I've used the OnConversationLine method. Turns out I did something very similar to send every subtitle ran to the player.log file.
However, I've needed to make a modification so that only the last non-dialogue entries are saved:
That is, I'm discriminating which dialogue entry's sequence to save, because I'm not interested in the ones that are used to display dialogue, only the ones that I use for animation shortcuts, such as the one above.
So, it's working.
However, I think it would be ideal to trigger this from a LUA script command instead, so it could be run on demand before jumping to the next entry, even when the sequence contains an immediate Continue() command. And then use [var=xxx] on the next entry, with the peace of mind that it won't be overwritten until you run the LUA command again.
Bonus points, you know.
Edit: I'm reading that code I've written and I'm realizing it doesn't look good. I should have used == instead of !=. So I don't know how the hell it's working regardless.
Edit 2: I've removed the conditional so it's run on every line, and it turns out the variable stored is still the one from the previous entry. That must mean it takes a while to store it back to DS, which serves my purpose, funnily enough.
However, I've needed to make a modification so that only the last non-dialogue entries are saved:
Code: Select all
if (this.subtitle != null)
{
sequence = (conversation != null) ? conversationState.subtitle.dialogueEntry.currentSequence : "";
DialogueLua.SetVariable("LastSequence", sequence);
}
So, it's working.
However, I think it would be ideal to trigger this from a LUA script command instead, so it could be run on demand before jumping to the next entry, even when the sequence contains an immediate Continue() command. And then use [var=xxx] on the next entry, with the peace of mind that it won't be overwritten until you run the LUA command again.
Bonus points, you know.
Edit: I'm reading that code I've written and I'm realizing it doesn't look good. I should have used == instead of !=. So I don't know how the hell it's working regardless.
Edit 2: I've removed the conditional so it's run on every line, and it turns out the variable stored is still the one from the previous entry. That must mean it takes a while to store it back to DS, which serves my purpose, funnily enough.
Unity 2019.4.9f1
Dialogue System 2.2.15
Dialogue System 2.2.15
Re: Store dialogue entry sequence in a variable?
It sounds like you have it working now. If you need any help with changes, let me know.
Re: Store dialogue entry sequence in a variable?
Yes, thank you. And sorry for the mess of my post. I need to learn to experiment more, then actually write. And also trying to avoid working at 2 am.
Unity 2019.4.9f1
Dialogue System 2.2.15
Dialogue System 2.2.15