playMaker

Author Topic: Accessing FsmVariables in a custom action? [Solved]  (Read 2989 times)

Tricky_Widget

  • Junior Playmaker
  • **
  • Posts: 62
Accessing FsmVariables in a custom action? [Solved]
« 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!
« Last Edit: July 13, 2015, 08:24:48 AM by Tricky_Widget »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Accessing FsmVariables in a custom action?
« Reply #1 on: July 11, 2015, 12:52:42 PM »
Hi, maybe add .Value

what are you trying to make?

Did you check the EcoSystem for custom actions?

Tricky_Widget

  • Junior Playmaker
  • **
  • Posts: 62
Re: Accessing FsmVariables in a custom action?
« Reply #2 on: July 11, 2015, 01:01:50 PM »
Hi, maybe add .Value

what are you trying to make?

Did you check the EcoSystem 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.  :)

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: Accessing FsmVariables in a custom action?
« Reply #3 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

Tricky_Widget

  • Junior Playmaker
  • **
  • Posts: 62
Re: Accessing FsmVariables in a custom action?
« Reply #4 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 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.  :)