Page 1 of 1

Importing Gamespace Variable to Dialogue System

Posted: Tue Feb 10, 2015 7:30 am
by GUmlauf
I feel this is a dumb question, but I've been looking around the documentation for a while and I can't find what I'm looking for.  Quite simply, I want to take a public variable existing in a C# MonoBehavior and set one of the Dialogue System's Lua variables equal to that value.  I've seen functions such as FPPlayerLuaBridge, but I'm not storing this variable in any supported third-party system and I need a generic LuaBridge, which doesn't seem to exist.  I'm pretty sure I'm just missing something basic; can I make a sequencer command that doesn't have to return a void?  Is there a built-in function to do this that I'm just not seeing?

Importing Gamespace Variable to Dialogue System

Posted: Tue Feb 10, 2015 9:01 am
by Tony Li
Hi,



Use DialogueLua.SetVariable. For example:

using PixelCrushers.DialogueSystem;



bool myValue = true;



DialogueSystem.SetVariable("MyValue", myValue);

If you want to go the other way (set a C# variable from inside Lua code), you can register your own C# method as a Lua function.



If you want to set the variable before or after a certain Dialogue System operation, such as the start of a conversation, you can add a method that handles one of the Dialogue System's script messages.