More Awesome Than You!

The Bowels of Trogdor => The Large Intestines of Trogdor => Topic started by: pbox on 2011 January 26, 05:52:32



Title: Scripting question (Event listening)
Post by: pbox on 2011 January 26, 05:52:32
Is it possible to listen for a "GotPaidEvent" instead of any old event? I specifically need the PayType.

Also, when there's more than one listener for an event, what determines the order in which their actions are processed?


Title: Re: Scripting question (Event listening)
Post by: J. M. Pescado on 2011 January 26, 06:23:56
Set a listen for EventTypeId.kGotPaid, do an Is test for GotPaidEvent, and then cast and scan if so.

If more than one listener for an event exists, the execution will occur in arbitrary order, so don't rely on any specific order. No existing event listener is sensitive to order of execution, and you should probably not be throwing up tons of listeners for whatever you're doing. Just add a single global listener as part of the static class and process the spool from there.