Hi,
Is it possible to get custom Conversation Field by conversation title in C#?
In the documentation I see only a method:
GetConversationField()
which take converstation ID (int).
I cannot find anything that can help me to transtale Title into the ID.
How to get conversation field by string
Re: How to get conversation field by string
I have a temporary solution:
I save reference to database where conversation is and then I get the Conversation object. However, when I try go get my custom field "Tags" I get the following error:
I save reference to database where conversation is and then I get the Conversation object. However, when I try go get my custom field "Tags" I get the following error:
All conversation have Tags field and all of them have unique ID. I am not able understand where is the problem...Dialogue System: Lua code 'return Conversation[9].Tags' threw exception 'Lookup of field 'Tags' in the table element failed because the table element itself isn't in the table.'
Re: How to get conversation field by string
Hi,
If you're not making runtime changes, you can get the Tags field directly from the dialogue database using DialogueDatabase.GetConversation() to get a conversation by Title or ID:
If you need to get the runtime value from Lua:
If you're not making runtime changes, you can get the Tags field directly from the dialogue database using DialogueDatabase.GetConversation() to get a conversation by Title or ID:
Code: Select all
var conversation = DialogueManager.masterDatabase.GetConversation("Some Title");
string tags = conversation.LookupValue("Tags");
Code: Select all
var conversation = DialogueManager.masterDatabase.GetConversation("Some Title");
string tags = DialogueLua.GetConversationField(conversation.id, "Tags").asString;
Re: How to get conversation field by string
Hi,
Thanks for response.
What in case if I have many databases, e.g. DLC with additional content?
Thanks for response.
What in case if I have many databases, e.g. DLC with additional content?
Re: How to get conversation field by string
Hi,
If you have multiple databases, you'll use Extra Databases to load additional databases into memory.
DialogueManager.masterDatabase will contain the content of all of the databases loaded into memory.
If you have multiple databases, you'll use Extra Databases to load additional databases into memory.
DialogueManager.masterDatabase will contain the content of all of the databases loaded into memory.
Re: How to get conversation field by string
Hi,
Thanks for info. It solve my problem!
I check in the documentation that there is info that MasterDatabase fields contains all data. However, I suggest to add this info into "Standard documentation" e.g. in the section "Working With Multiple Databases/Extra Databases".
Best!
Thanks for info. It solve my problem!
I check in the documentation that there is info that MasterDatabase fields contains all data. However, I suggest to add this info into "Standard documentation" e.g. in the section "Working With Multiple Databases/Extra Databases".
Best!
Re: How to get conversation field by string
Good idea! Will do.