playMaker

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - HardLight680

Pages: [1]
1
Share New Actions / Fully Nestable SubFSM Communication
« on: May 07, 2018, 02:03:48 PM »
I made up a small action that allows you to run FSM templates and return data back to the caller regardless of whether the caller is a sub FSM or a host FSM. It is entirely self-contained, so there is no need to use additional actions besides the one RunFSMFunc action. There is no need for any special actions inside the sub FSM either.



The operating principles are similar to the RunFSM action. Variables with the Inspector attribute will appear as inputs, and the sub FSM may terminate using the FinishFSM action.

As a new addition, variables in the template that are inside the 'Output' category will appear as outputs which can be captured into variables for the calling FSM. Output variables are automatically copied by value up into the calling FSM's capture variables when the sub FSM ends without the need for any special actions.

Additionally, string variables in the template that are inside the 'Events' category will generate event selection fields on the action. The template FSM can use those string variables in SendFSMByName with the HostFSM target type in order to send caller specified events back to the caller.

Note that if the calling state ends while a sub FSM is still running, the sub FSM is immediately ended and its current output values are copied to the calling FSM. As a result, if a sub FSM output event causes a state transition in the caller, the sub FSM ends and its current computed values are copied out.

The package contains samples for Factorial and MergeSort FSM templates to show the basics of how it is used, and to show how this can be used for recursive FSM programming.

2018/05/08: Updated to support FSM event outputs.


* PlaymakerRunFsmFunc.unitypackage

Pages: [1]