playMaker

Author Topic: About FSM Templates and how to make them produce and ouput from an input  (Read 2690 times)

ramones

  • Playmaker Newbie
  • *
  • Posts: 42
Hi!,

I'm starting to grasp the concept of FSM Templates in playmaker. For me they look the same as procedures in any regular language (call with no return values). Is there any possibility to convert them in functions? Something like blackboxes where parameters are pushed and return values can be extracted? They would be of a lot of use to reusability.

Note: I have just read about the RunFSM action. This  seems what I would need but If I could return a value from it or at least configure more than on "Output events" not just the finished event.

Note2: I have discovered (yay!) that I can send an event from a SubFSM to the Host. So I suppose this could be used to send a custom event as a response instead of just "Finished". Is it possible to send with the event any kind of meta data like an int value, etc...?

Thanks in advance,
Cheers.
« Last Edit: April 26, 2013, 11:38:33 AM by ramones »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Quote
Is it possible to send with the event any kind of meta data like an int value, etc...?

Yes, you can use the Set Event Data action for this.

ramones

  • Playmaker Newbie
  • *
  • Posts: 42
Thanks a lot for the answer Alex.

On the other hand. I have a little doubt about fsm templates. When I paste a fsm template in a fsm does it still reference the template? I mean, If I modify the template will the pasted nodes refresh (I suppose they don't but just to be sure). And last question is there any good way to set a Host var from a subFSM?.

Thanks in advance.

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
A pasted template is independent of the original. It will NOT update when the original template is changed!

However, a template referenced in a Run FSM action or specified in the FSM inspector WILL update with the original.

There's currently no action to set variables in the Host FSM. You should use Send Event for now...

ramones

  • Playmaker Newbie
  • *
  • Posts: 42
Ok, understood. Thanks for the clear and fast response.

I think something like a "public" tick in Host FSM variables would be nice to let subFSM reference them with no hassle. I think it resembles to calling a function inside a class. The class has data and shares data among all its methods.

By the way I have found some bugs when assigning a template in the FSM tab to a state. Don't know how I did it but it broke my FSM several times blowing all transitions away and collapsing states when I set the template and then remove it.

I will try to reproduce it again.

Cheers.