Hey, I appreciate that 'thisID' is available as a special variable for lua conditions. Is there a special variable to get the current conversation ID? If not how would you recommend getting the current conversation ID for a dialog entry condition?
Thanks!
Lua conversation context
Re: Lua conversation context
Hi,
Are you talking about the Conditions field of a dialogue entry?
All SimStatus values are stored in Conversation[X].Dialog[Y], where X is a conversation ID and Y is a dialogue entry ID. So if you check conversation 7, entry 42's SimStatus, it would be Conversation[7].Dialog[42].SimStatus.
"Dialog[Y]" without the Conversation[X] part is an alias for the current conversation's Dialog[] table. So if the current conversation is conversation 7, you can just use Dialog[42].SimStatus. Or, if the current dialogue entry is 42, just Dialog[thisID].SimStatus.
If you need to know the conversation ID in C#, it's DialogueManager.lastConversationID. The title is DialogueManager.lastConversationStarted.
Are you talking about the Conditions field of a dialogue entry?
All SimStatus values are stored in Conversation[X].Dialog[Y], where X is a conversation ID and Y is a dialogue entry ID. So if you check conversation 7, entry 42's SimStatus, it would be Conversation[7].Dialog[42].SimStatus.
"Dialog[Y]" without the Conversation[X] part is an alias for the current conversation's Dialog[] table. So if the current conversation is conversation 7, you can just use Dialog[42].SimStatus. Or, if the current dialogue entry is 42, just Dialog[thisID].SimStatus.
If you need to know the conversation ID in C#, it's DialogueManager.lastConversationID. The title is DialogueManager.lastConversationStarted.
-
- Posts: 13
- Joined: Sun Jan 24, 2021 6:18 pm
Re: Lua conversation context
Hey Tony,
Thank you for the response. After some investigation I found a way to have the current conversation ID value available during entry conditions and scripts. I added this component to the Dialogue Manager.
I with this value was available out of the box like 'thisID' or as a special variable like Variable["ConversationIndex"].
Thanks!
Thank you for the response. After some investigation I found a way to have the current conversation ID value available during entry conditions and scripts. I added this component to the Dialogue Manager.
Code: Select all
public class PrepareDialogueEntry : MonoBehaviour
{
public void OnPrepareConversationLine(DialogueEntry entry)
{
Lua.Run($"thisConversation = {entry.conversationID}");
}
}
Thanks!
Re: Lua conversation context
Thanks for sharing your solution!