Page 1 of 1

Creating UI tracker for variables

Posted: Fri Mar 12, 2021 12:59 pm
by annathehank
Hi again!

This time I'm trying to figure out how to create a UI system like the quest log window but one that stores variable information. For example, a window that would display information about people as you meet them. I have bool variables set up that are basically "person a met" that I set to true once the player has a conversation with them, and the description is information about that person. I was kind of trying to reverse-engineer the quest window UI in the basic pre-fab, but I can't seem to tell where the fields are gathering the quest information from the dialogue manager.

Are variables public? Is there a way to call them from other scripts? And if so, how?

Thank you!

Re: Creating UI tracker for variables

Posted: Fri Mar 12, 2021 2:13 pm
by Tony Li
Hi,

Yes, variables are public. You can get their current values using DialogueLua.GetVariable(). To enumerate all of the variables in your database, examine DialogueManager.masterDatabase.variables. Example:

Code: Select all

foreach (Variable variable in DialogueManager.masterDatabase.variables)
{
    if (variable.Type == FieldType.Boolean)
    {
        Debug.Log($"Variable[{variable.Name}] = {DialogueLua.GetVariable(variable.Name).asBool}");
    }
}

Re: Creating UI tracker for variables

Posted: Sun Mar 14, 2021 10:54 am
by annathehank
Ahh thank you so much! I knew they were stored somewhere I just wasn't sure where to look for them <3

Re: Creating UI tracker for variables

Posted: Sun Mar 14, 2021 12:29 pm
by Tony Li
Glad to help!