My previous post was lost because this forum has dissociative identity disorder and lets you log in using vbulletin, but logs you out if you try to navigate to another page unless you're logged in using curse. Just thought I'd mention how extremely confusing it is being repeatedly directed to the vbulletin login when that system doesn't work at all.
Anyway, I'm trying to create a dependency for a few of my other addons, and I want to have it trigger a custom event to register for in the other addons, but I'm not sure what the best way to go about doing that is.
For example, I'll parse the combat log in the dependency for a new enemy entering combat with my group and trigger "NEW_CHALLENGER_APPEARS," which I guess is just some global function I define and call.
I can think of at least three different ways to watch for this event. The first thing that comes to mind is just hooking the function. Then there's hooking RegisterEvent itself and possibly changing how it works, or some sort of callback function in the dependency to queue up an array of functions to call along with NEW_CHALLENGER_APPEARS().
How do you guys handle this? Is there some standard or even something in the API I missed?
RegisterEvent won't do anything for you, and changing the behavior of such a fundamental API is a terrible idea.
There are several to go about doing what you want, that won't impact the functionality of other addons or the default UI:
[*] Use AceEvent-3.0 and the [URL="http://www.wowace.com/addons/ace3/pages/api/ace-event-3-0/#w-ace-event-register-message-message-callback-arg"]RegisterMessage/SendMessage[/URL] API.
[*] Use [URL="http://www.wowace.com/addons/callbackhandler/"]CallbackHandler-1.0[/URL].
[*] Write your own function to handle callback registration.
List tags are malformed.
Ah, thank you. I didn't know if there was some official way of doing events or if you just had to make your own callback function (I was trying to search for custom events, not callbacks, terminology gah). I'll look into callbackhandler and see if I should implement that or just write my own. I'm thinking it would simply be a table for the "event", and a couple functions to insert and remove functions to call, or even a metatable if I need to implement it more than once.