playMaker

Author Topic: CustomActionEditor Set FsmVar[] variable Issue [SOLVED]  (Read 5268 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: CustomActionEditor Set FsmVar[] variable Issue
« Reply #15 on: April 27, 2018, 04:01:48 AM »
Hi,

 yeah, Alex confirmed that you'll need to use strings and not fsmVar directly.

 - what do you want to achieve? If you explain to me, I may have a solution for this.

 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: CustomActionEditor Set FsmVar[] variable Issue
« Reply #16 on: April 27, 2018, 04:52:16 AM »
Hi Jean

Ok I am basically creating actions which will target a group of FsmArray's that have a prefix of XXXX (user specified in action) and perform some action on those arrays. Similar to the standard array actions (e.g. add row, delete row ect...)

I created my first action which is to add a row to an array. But instead of one array I want to target multiple arrays at once and iterate through them. So I decided I would target them my using a prefix. The lead me to create a CustomActionEditor. Inside this im finding all instances of FsmVar with the prefix and saving them in a FsmVar[] during EditMode. Not during runtime. As I see no point in doing so. This will save time when the game runs.

Note: It obviously works if my action is on the same FSM as the prefixed arrays but I didnt want it to behave only in this scenario, also its not ideal for others if i submit these to the ecosystem as its then very restrictive with various game structures.

Hope this makes sense.

Nick

« Last Edit: April 27, 2018, 08:20:20 AM by coxy17 »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: CustomActionEditor Set FsmVar[] variable Issue
« Reply #17 on: May 02, 2018, 02:56:51 AM »
Hi,

 I would totally do this at runtime, the cost of this kind of routine is totally fine really. The most important thing is to not do this every frame but only when the action begins.

but by the look of it, what you really need is a "Meta data" fsm. when I need some array or variables to be used bye several fsms, I have one fsm responsible for them, and all other fsm, go read and write to that fsm, and any value inside these fsm are temporary and must not be taken from granted. So everytime I go get a variable using GetFsmXXX, I work with it, then I use SetFsmXXX, and for more complex use, I send a global even "FSM A / JOB DONE" for example, so that other fsm that needs to use the same values from the Meta data fsm knows. Also I use wait next frame event sometimes so that upon reception of a given global event, "DO THIS", several fsm needs to work with the same data, so one fsm will do that straight away, while another fsm will wait one frame and then do something.

 
 Bye,

 Jean

coxy17

  • Beta Group
  • Sr. Member
  • *
  • Posts: 355
Re: CustomActionEditor Set FsmVar[] variable Issue
« Reply #18 on: May 11, 2018, 02:08:42 PM »
Hi Jean,

I received your response and I updated it to work with strings instead. I just put in a detection to use FsmVar[] if the action is placed on the same FSM. Thanks for looking into this anyway.

Nick