playMaker

Author Topic: registering for a global event from script  (Read 3933 times)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
registering for a global event from script
« on: December 20, 2011, 07:17:07 AM »
Hi,

 ok, far reach maybe, but I'd like to avoid intermediate fsm between playmaker environment and conventionnal scripts.

 Everytime I want a script to react to something happening in playmaker, I have to create a dumb fsm that receive the event and use "invoke Method" or send a message etc.

 Now, I'd enjoy a way to register a method in a script to be called on a given global event.

 something like:

FSMInterface.FsmEvents.RegisterMethodforGlobalEvent("MY EVENT",methodName)

or

FSMInterface.FsmEvents.RegisterMethodforGlobalEvent(fsmEvent,methodName)

Where event ref is an actual reference to an event, not just a string.

The method would then have to comply to a signature or have a way to be able to get data from the event etc etc.
 
 I appreciate this would blur event tracking tho, so might not a be a good idea from the perspective of debugging, but then again... it would be nice to avoid fsm doing nothing particularly useful and would be pretty much a tool for advance usage after all.

Bye,

 Jean