playMaker

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

xeondream

  • Playmaker Newbie
  • *
  • Posts: 2
    • View Profile
[solved] passing variables from custom script to fsm
« on: June 15, 2012, 01: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, 03:04:23 AM by xeondream »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 14237
  • Official Playmaker Support
    • View Profile
Re: passing variables from custom script to fsm
« Reply #1 on: June 15, 2012, 02: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
    • View Profile
Re: passing variables from custom script to fsm
« Reply #2 on: June 15, 2012, 03:03:49 AM »
thanks jean. it works ^^.

lalamax3d

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