playMaker

Author Topic: SendEvent based on fired event?  (Read 1681 times)

ramones

  • Playmaker Newbie
  • *
  • Posts: 42
SendEvent based on fired event?
« on: April 27, 2013, 05:54:41 AM »
Hi!,

I would like to clear a bit one of my FMS and wanted to use some global transitions to clean this spagetti I have :).

Mainly I want to use 2 global transitions "ExitWithAnimation" and "ExitWithoutAnimation". This will be called from some parts of this fsm depending on the player selections (this fsm covers a part of my UI logic).

On the other hand I have a custom action that shows a Yes/No dialog that returns to the fsm through sendEvent what the user chosed. I need to send the user to one of this global transition if I get a "No" event. Is this possible to do without creating a transition from the current state, from the No event to another state that sends the event to move to the global transition? I don't want this because state ids seems to be based on the name and then I should be naming this nodes "GoToExitWithNoAnimation1", "GoToExitWithNoAnimation2", etc...

Is there a better solution for all this?.

Thanks.
« Last Edit: April 27, 2013, 05:58:55 AM by ramones »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: SendEvent based on fired event?
« Reply #1 on: May 10, 2013, 05:45:30 AM »
Hi,

I am not sure I can make sense of your description :)

You can certainly use the action "Get last event", have you tried that? or are you looking to build a custom action to do this redirection? if so, yes you can too, you only need to fire the even within your custom action like the "send event" action does.

when I find myself in need ot several states with the same name ( it happens, tho it's a bad sign I agree), I simply add a space at the end of the name

"GoToExitWithNoAnimation " then it looks much nicer visually.

Have you also studied sub fsm? you could combine your redirection into a template, and reuse that template in several states. It would be clean too.

bye,

 Jean