Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Tricky_Widget on July 11, 2015, 11:10:39 AM

Title: Accessing FsmVariables in a custom action? [Solved]
Post by: Tricky_Widget on July 11, 2015, 11:10:39 AM
I'm writing a custom action, and I need to reference other variables in the current FSM by name.  I've been doing a lot of searching, and it seems like everyone uses something like this:
Code: [Select]
FsmInt intVariable = this.Fsm.FsmVariables.GetFsmInt("Name");
But when I try that code myself, I get this error:
Quote
error CS1061: Type `HutongGames.PlayMaker.Fsm' does not contain a definition for `FsmVariables' and no extension method `FsmVariables' of type `HutongGames.PlayMaker.Fsm' could be found (are you missing a using directive or an assembly reference?)

I'm baffled by this, as a Google for "Fsm.FsmVariables" turns up 328 results.  It seems like "Fsm" really should contain a definition for "FsmVariables", and yet for me it insists that it does not.

Does anyone have any idea what I'm missing?

Thanks!
Title: Re: Accessing FsmVariables in a custom action?
Post by: djaydino on July 11, 2015, 12:52:42 PM
Hi, maybe add .Value

what are you trying to make?

Did you check the EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181) for custom actions?
Title: Re: Accessing FsmVariables in a custom action?
Post by: Tricky_Widget on July 11, 2015, 01:01:50 PM
Hi, maybe add .Value

what are you trying to make?

Did you check the EcoSystem (https://hutonggames.fogbugz.com/default.asp?W1181) for custom actions?

I'm working with the 1.8 beta and I'm using the new array variable type.  I'm trying to make a sort of poor-man's multidimensional array by making a structured way to refer to a group of individual arrays.  But to do that, I need to get references to the various arrays in that group.  Ultimately I think I'm looking for something like Fsm.FsmVariables.GetFsmArray("Name"), but I figured that would confuse everyone who's not in the beta.  :)
Title: Re: Accessing FsmVariables in a custom action?
Post by: djaydino on July 11, 2015, 01:34:55 PM
Hi,
I Think you should ask on the beta forum then.

many things are changed on 1.8
Title: Re: Accessing FsmVariables in a custom action?
Post by: Tricky_Widget on July 13, 2015, 08:24:30 AM
I Think you should ask on the beta forum then.

many things are changed on 1.8

Well, I tried it in 1.7.3 and got the same result, so it's not a beta thing.  However, I dug up the API Reference (https://hutonggames.fogbugz.com/default.asp?W1098) and discovered that FsmVariables is a type.  And the way to get the current one is "Fsm.Variables".  Which works like a charm.

How on earth all those "Fsm.FsmVariables" examples I saw works remains a mystery.  But "Fsm.Variables" is the answer I needed.  :)