playMaker

Author Topic: [Solved] Is there a way to prioritize local before global events?  (Read 1854 times)

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Hi,

assume 2 states which have the same event, but one is setup as global transition and the other as local transition. Now it seems the global transition is either executed first always or this is some kind of event setup order result.

What i need is a way that would prioritize the same local event first, so the state can have special logic.

As example, think of a global "Power Off" event, that should only trigger  "closing" logic, if the Fsm is in the open/opening states.
I did add the "Power Off" event to those states, but those are never triggered and always the default global version is used.

The alternative would be to add local "Power Off" transitions to every single state in the Fsm, assuming that most things this objects do, need power. Aside from the visual clutter, this also increases the chance to forget this transition in future added states, thats why i would like to keep the global version and just add special transition logic on a per state basis.

thx Andy


PS: Just noticed there is a other way to use "get previous state" with a "Fsm State Test" action.
« Last Edit: January 16, 2014, 01:00:20 PM by Andy22 »

Andy22

  • Junior Playmaker
  • **
  • Posts: 99
Re: Is there a way to prioritize local before global events?
« Reply #1 on: January 16, 2014, 01:00:07 PM »
Can kinda answer my own question, there was a logic error on my part. The problem exists because i tried to map multiple logical states, that a object can be in at the same time, with just one FSM. The important part is the "F" for finite :p

The correct solution was to separate the 2 conflicting logic states into 2 Fsm's and enable/disable the Fsm itself. So basically separate PowerOn/Off, Powered Logic and Unpowered Logic into 2 different Fsm's.

bye Andy

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [Solved] Is there a way to prioritize local before global events?
« Reply #2 on: January 24, 2014, 08:04:42 AM »
Hi,

 Yep, divide and conquer is the way to go, never fear having multiple fsms, it's generally the best way to create rich and complex behaviors.

bye,

 Jean