playMaker

Author Topic: [SOLVED] Global Variables  (Read 4702 times)

MGuy

  • Playmaker Newbie
  • *
  • Posts: 5
[SOLVED] Global Variables
« on: March 02, 2012, 03:30:41 AM »
How do I set/get a global variable from my script?

Thanks.
« Last Edit: March 04, 2012, 08:45:39 PM by MGuy »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Global Variables
« Reply #1 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;

MGuy

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Global Variables
« Reply #2 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.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 3987
  • Official Playmaker Support
    • LinkedIn
Re: Global Variables
« Reply #3 on: March 02, 2012, 06:29:45 PM »
Sorry, add this:

Code: [Select]
using HutongGames.PlayMaker;

MGuy

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Global Variables
« Reply #4 on: March 04, 2012, 08:44:58 PM »
Sorry, add this:

Code: [Select]
using HutongGames.PlayMaker;

Thanks.   :)

thatfoolsean

  • Playmaker Newbie
  • *
  • Posts: 1
Re: [SOLVED] Global Variables
« Reply #5 on: October 26, 2012, 12:34:12 AM »
How do I do this in JavaScript?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [SOLVED] Global Variables
« Reply #6 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;

}