Adventure Creator and Dialogue System variable sync

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Adventure Creator and Dialogue System variable sync

Post by DragoonHP »

A few questions related to variable syncing.

* How do I access Adventure Creator variables from Dialogue System Database? (Something like Variable["name"] = 10 from the Entries in the Conversation tab)
* Do I need to define the global variables in the Dialogue Database to be able to use them?(I did it and the values are not syncing. I have a variable defined in both Global and Dialogue Database, but after the conversation ends, it doesn't sync. This is how the Adventure Creator Bridge is set up.
Image
***
Image
* Can I access variables defined in DialogueSystem from Adventure Creator?
* Can I change Adventure Creator Local variables from Dialogue System Database?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adventure Creator and Dialogue System variable sync

Post by Tony Li »

Hi,
DragoonHP wrote: Mon Feb 11, 2019 8:14 am* Can I access variables defined in DialogueSystem from Adventure Creator?
* Can I change Adventure Creator Local variables from Dialogue System Database?
Yes. In Sync Settings, have you ticked Copy AC Variables To Dialogue System and Copy Dialogue System To AC Variables?
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Re: Adventure Creator and Dialogue System variable sync

Post by DragoonHP »

Yes I have

I have this [c]DialogueSystemEnvironment[/c] Global variable in AC which only contains all the variables defined as Global Variable in AC.
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adventure Creator and Dialogue System variable sync

Post by Tony Li »

With those settings, it should be copying the AC values to DS when a conversation starts, and then copying the DS values back to AC when the conversation ends.

Please try this:

1. Add a Lua Console to the Dialogue Manager.

2. Play the scene and start a conversation. This will copy AC's variables to DS.

3. Press ~+L to open the Lua Console. Enter this:

Code: Select all

return Variable
It should list the values of variables copied from AC.

4. Choose a variable and change it by entering a command like this into the Lua Console:

Code: Select all

Variable["Found_sword"] = true
5. Click the 'X' button to close the Lua Console.

6. End the conversation. This will refresh AC's variables from the values in DS.

7. In AC's editor, check the current value of the variable. Its value should be what you set it to in the Lua Console.

If it isn't, please let me know if there are any warnings or errors in the Unity editor console, and what versions of Unity, AC, and DS you're using.
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Re: Adventure Creator and Dialogue System variable sync

Post by DragoonHP »

Okay it works. The values are just not updated in the Variable Tab of AC

Also, will variables defined in DS (that are not defined in AC) be available in AC? If yes, how can I access them?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adventure Creator and Dialogue System variable sync

Post by Tony Li »

Hi,
DragoonHP wrote: Tue Feb 12, 2019 11:50 amOkay it works. The values are just not updated in the Variable Tab of AC
You need to enable live runtime view in AC's editor window.
DragoonHP wrote: Tue Feb 12, 2019 11:50 amAlso, will variables defined in DS (that are not defined in AC) be available in AC? If yes, how can I access them?
To access DS variables that aren't in AC, use the Third Party: Dialogue System Lua action.
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Re: Adventure Creator and Dialogue System variable sync

Post by DragoonHP »

So the usual Variable["name"] will work there?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adventure Creator and Dialogue System variable sync

Post by Tony Li »

Yes. If your variable name has blank spaces, replace them with underscores ( _ ).
DragoonHP
Posts: 62
Joined: Tue Jan 15, 2019 8:17 am

Re: Adventure Creator and Dialogue System variable sync

Post by DragoonHP »

Thanks.
And correct me f I'm wrong, but there is no way to access local AC variables from DS right?
User avatar
Tony Li
Posts: 21678
Joined: Thu Jul 18, 2013 1:27 pm

Re: Adventure Creator and Dialogue System variable sync

Post by Tony Li »

The bridge copies over local variables, too.

If a local variable and a global variable have the same name, such as MyAwesomeVar, you can tick the bridge's Prepend Global Variables checkbox to distinguish them in the Dialogue System. In DS, the global variable version will have "global_" in front, such as Variable["global_MyAwesomeVar"] for the global and Variable["MyAwesomeVar"] for the local.
Post Reply