How to keep track of variables?

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

How to keep track of variables?

Post by pegassy »

I have started using many variables through DSU in my prototype, and mostly for setting up conversation and scenario conditions. However, I really would like to track those while debugging the story. Is there a way to figure out what the value of a given variable is at a given time?

Thank you.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to keep track of variables?

Post by Tony Li »

Hi,

Yes, several ways. In the Unity editor, the Dialogue Editor window's Templates tab turns into a Watches tab during play. You can add watches on variables, quest states, and more.

You can also add a Lua Console component to the Dialogue Manager. During play, press ~+L to open the console and enter expressions such as:

Code: Select all

return Variable
to show the values of all variables, or:

Code: Select all

return Variable["Foo"]
to show the value of the variable Foo. This is handy in builds where you can't access the Dialogue Editor window. You can also register your own C# methods with Lua and use them in the Lua Console. Since you're using Opsive UCC, you can use the UCC Lua Functions to give items, add health, etc.

You can get the value of a variable in a script using DialogueLua.GetVariable or an equivalent visual scripting action, or add a Lua Observer.
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: How to keep track of variables?

Post by pegassy »

This is awesome. Thank you Tony.
pegassy
Posts: 135
Joined: Sat Mar 17, 2018 8:07 pm

Re: How to keep track of variables?

Post by pegassy »

This feature is so helpful. I could not figure out what kept messing one of the variables, and I caught it this time. It was a changed hidden within a silly bark that I even forgot that I had set up much earlier.
User avatar
Tony Li
Posts: 22057
Joined: Thu Jul 18, 2013 1:27 pm

Re: How to keep track of variables?

Post by Tony Li »

Glad you found it! There's also the Dialogue Manager's Debug Level > Info. But while it can provide all the sordid details of when Script and Conditions fields run, it's a lot to pick through.
Post Reply