Page 1 of 1

Updating PixleCrusher Vars threw C# script

Posted: Thu Sep 22, 2022 6:42 pm
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?

Re: Updating PixleCrusher Vars threw C# script

Posted: Thu Sep 22, 2022 8:20 pm
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);

Re: Updating PixleCrusher Vars threw C# script

Posted: Thu Sep 22, 2022 9:14 pm
by Aldurroth
Sweet. I'll give it a go thanks!