Page 1 of 1
How to keep track of variables?
Posted: Fri Jan 04, 2019 9:05 pm
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.
Re: How to keep track of variables?
Posted: Fri Jan 04, 2019 10:15 pm
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:
to show the values of all variables, or:
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.
Re: How to keep track of variables?
Posted: Sat Jan 05, 2019 9:20 pm
by pegassy
This is awesome. Thank you Tony.
Re: How to keep track of variables?
Posted: Sat Jan 05, 2019 10:32 pm
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.
Re: How to keep track of variables?
Posted: Sat Jan 05, 2019 10:38 pm
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.