playMaker

Author Topic: [solved] passing variables from custom script to fsm  (Read 16276 times)

xeondream

  • Playmaker Newbie
  • *
  • Posts: 2
[solved] passing variables from custom script to fsm
« on: June 15, 2012, 04:55:34 AM »
hi all, i got a custom script with say this string variable "abc". how do i pass it to playmaker fsm so that i can set my string from custom script to my global variable string in my fsm?
« Last Edit: June 15, 2012, 06:04:23 AM by xeondream »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: passing variables from custom script to fsm
« Reply #1 on: June 15, 2012, 05:26:15 AM »
Hi,

 There is a script example showing how to achieve this:

http://hutonggames.com/playmakerforum/index.php?topic=1733.msg7631#msg7631

Basically you need to

1: be using HutongGames.PlayMaker
2: create a public variable of type FsmComponent (let's call it "myFsm", where you can then drag a fsm component on it
3: access its variables like so:

myFsm.FsmVariables.GetFsmString("my string variable").Value = "hello"

or string myString = myFsm.FsmVariables.GetFsmString("my string variable").Value ;


Bye,

 Jean

xeondream

  • Playmaker Newbie
  • *
  • Posts: 2
Re: passing variables from custom script to fsm
« Reply #2 on: June 15, 2012, 06:03:49 AM »
thanks jean. it works ^^.

lalamax3d

  • Playmaker Newbie
  • *
  • Posts: 12
Re: [solved] passing variables from custom script to fsm
« Reply #3 on: August 10, 2013, 04:14:58 AM »
thanks
it helped..