Updating PixleCrusher Vars threw C# script

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
Aldurroth
Posts: 43
Joined: Wed Jul 20, 2022 8:44 pm

Updating PixleCrusher Vars threw C# script

Post by Aldurroth »

Hello, I have a clock that is running in my game that I would like to keep track of in the PixleCrushers Variables tab. The way it works is it's basically a float. So 0.5 would just be half a day. So basically if the clock counter is 0.5, I would like my PixleCrushers var to update along side that. I'll have events happen at specific times so communicating with my Var database will be important.

So...I guess how do I get access to my vars from my script?
User avatar
Tony Li
Posts: 22143
Joined: Thu Jul 18, 2013 1:27 pm

Re: Updating PixleCrusher Vars threw C# script

Post by Tony Li »

Hi,

Use the DialogueLua class, in particular DialogueLua.GetVariable() and DialogueLua.SetVariable():

Code: Select all

float clock;
...
// Example: Advance by half a day:
float currentTimeOfDay = DialogueLua.GetVariable("Clock").asFloat;
DialogueLua.SetVariable("Clock", currentTimeOfDay + 0.5f);
Aldurroth
Posts: 43
Joined: Wed Jul 20, 2022 8:44 pm

Re: Updating PixleCrusher Vars threw C# script

Post by Aldurroth »

Sweet. I'll give it a go thanks!
Post Reply