Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: MGuy on March 02, 2012, 03:30:41 AM

Title: [SOLVED] Global Variables
Post by: MGuy on March 02, 2012, 03:30:41 AM
How do I set/get a global variable from my script?

Thanks.
Title: Re: Global Variables
Post by: Alex Chouls on March 02, 2012, 03:52:56 PM
A quick example:

Code: [Select]
var globalVariables = FsmVariables.GlobalVariables;
var numLives = globalVariables.GetFsmInt("numLives");
numLives.Value = 3;
Title: Re: Global Variables
Post by: MGuy on March 02, 2012, 06:11:04 PM
Is FsmVariables a static object?  I can't seem to access this object from my c# script.
Title: Re: Global Variables
Post by: Alex Chouls on March 02, 2012, 06:29:45 PM
Sorry, add this:

Code: [Select]
using HutongGames.PlayMaker;
Title: Re: Global Variables
Post by: MGuy on March 04, 2012, 08:44:58 PM
Sorry, add this:

Code: [Select]
using HutongGames.PlayMaker;

Thanks.   :)
Title: Re: [SOLVED] Global Variables
Post by: thatfoolsean on October 26, 2012, 12:34:12 AM
How do I do this in JavaScript?
Title: Re: [SOLVED] Global Variables
Post by: jeanfabre on October 26, 2012, 01:57:53 AM
hi,

It's very similar:

Code: [Select]
#pragma strict
import HutongGames.PlayMaker;

function Start () {


var globalVariables = FsmVariables.GlobalVariables;
var numLives = globalVariables.GetFsmInt("numLives");
numLives.Value = 3;

}