Query Database for Line Count / Character

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Query Database for Line Count / Character

Post by VoodooDetective »

Is there a way to run queries against a dialogue database to get statistics like lines per character?
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Query Database for Line Count / Character

Post by Tony Li »

Hi,

It's just a C# structure. You can read through it to pull together numbers of statistics. Example:

Code: Select all

int actorID = database.GetActor("Player").id;
int numLines = 0;
foreach (var conversation in database.conversations)
{
    foreach (var entry in conversation.dialogueEntries)
    {
        if (entry.actorID = actorID) numLines++;
    }
}
Debug.Log("Lines spoken by player: " + numLines);
LINQ queries would be probably be more succint than the code above.
VoodooDetective
Posts: 222
Joined: Wed Jan 22, 2020 10:48 pm

Re: Query Database for Line Count / Character

Post by VoodooDetective »

Oh perfect! Thank you!
User avatar
Tony Li
Posts: 22051
Joined: Thu Jul 18, 2013 1:27 pm

Re: Query Database for Line Count / Character

Post by Tony Li »

Happy to help!
Post Reply