Page 1 of 1

Query Database for Line Count / Character

Posted: Fri Nov 06, 2020 12:44 am
by VoodooDetective
Is there a way to run queries against a dialogue database to get statistics like lines per character?

Re: Query Database for Line Count / Character

Posted: Fri Nov 06, 2020 8:26 am
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.

Re: Query Database for Line Count / Character

Posted: Fri Nov 06, 2020 8:33 pm
by VoodooDetective
Oh perfect! Thank you!

Re: Query Database for Line Count / Character

Posted: Fri Nov 06, 2020 8:36 pm
by Tony Li
Happy to help!