Page 1 of 1
Speaker and Listener watches?
Posted: Fri Jul 30, 2021 1:56 pm
by Abelius
This is gonna look like a newbie question, but I didn't find anything on the forum.
Anyway... how can I add a watch on the Watches tab to figure out the current speaker and listener values of the running dialogue entry in an active convo?
I know I need to write a LUA expression there, but those things are definitely not "public" variables and I don't know how I should refer to them.
Thanks.
Re: Speaker and Listener watches?
Posted: Fri Jul 30, 2021 2:49 pm
by Tony Li
Hi,
The current speaker and listener aren't actually exposed to Lua. (The active conversation's actor and conversant are, in Variable["Actor"] and Variable["Conversant"].)
To get the current speaker and listener, you need to use C#: DialogueManager.currentConversationState.subtitle.speakerInfo and listenerInfo.
You could write a couple of C# methods and register them with Lua. Then put that Lua code into a watch.
Code: Select all
public string CurrentSpeaker()
{
if (!DialogueManager.isConversationActive) return string.Empty;
return GetActorName(DialogueManager.currentConversationState.subtitle.speakerInfo.id);
}
public string CurrentListener()
{
if (!DialogueManager.isConversationActive) return string.Empty;
return GetActorName(DialogueManager.currentConversationState.subtitle.listenerInfo.id);
}
public string GetActorName(int actorID)
{
Actor actor = DialogueManager.masterDatabase.GetActor(actorID);
if (actor == null) return "Unknown Actor ID " + actorID;
return actor.Name;
}
Re: Speaker and Listener watches?
Posted: Fri Jul 30, 2021 8:52 pm
by Abelius
Ah, it seems not so trivial as I thought at first.
TBH, this is just for troubleshooting purposes. Because I plan to use up to five generic NPC actors for multiple conversants in reusable convos, so Actor and Conversant are not good enough to know where my sequencer shortcuts are being sent each line.
But not critical at all, because I'm supposed to know who is NPC3 when I'm writing the conversation anyway. Will try to satisfy my OCD though.
Thanks!
Re: Speaker and Listener watches?
Posted: Fri Jul 30, 2021 11:30 pm
by Tony Li
You can also temporarily set the Dialogue Manager's Other Settings > Debug Level to Info. This will log the speaker as every subtitle appears.
Re: Speaker and Listener watches?
Posted: Sat Jul 31, 2021 7:22 am
by Abelius
Ah, perfect! Thank you.
Re: Speaker and Listener watches?
Posted: Sat Jul 31, 2021 7:52 am
by Tony Li
Glad to help!