self:Print("Mass award caught!")
I've looked at the CallBackhandler as suggested but from that I understand how I can fire my own messages but not how to catch them in my own addon.
There is a nice generic one that is handled by AceEvent-3 that addons can use to send each other messages. It has a proper registry that is derived from events that blizzard fires to frames. The 2 registry's don't mix.
Each addon can use it's own instance (read registry) for their own uses and that don't interact with other instances of CBH.
You need to find where the registry for that addon was placed. (read find where the code for CBH is added, something like [[ LibStub("CallbackHandler-1.0"):New(...) ]] and register your callbacks from there.
If you give me the name of the addon your trying to get this event from, i might be able to give you a cookie if you need it :)
To make it clear, though it is not your fault, your topic is mistitled. "event" references API events (e.g. fired by the game engine) where you are trying to catch custom messages fired by another addon using a library (namely CallbackHandler-1.0).
The relevant piece of code is this:
EPGP.callbacks = CallbackHandler:New(EPGP)
This creates the methods RegisterCallback and UnregisterCallback in EGPG that you can use EPGP.RegisterCallback(self, "MassEPAward") as gagou said.
Ah, thanks for the clarification!
So to recap- and to see if I understood correctly...
The EPGP addon declares a queue for its messages. Code that is interested in these messages can register themselves at that queue (so either the addon itself or a foreign addon). Whenever something is placed in the queue, the queueobject calls all the registered functions (the actual "callback").
Because the EPGP queue object is a global object I can register my addon's fuction to that queue thus receiving the messages that are placed in it.
This is because you are using the global variables arg1, arg2, ... that are deprecated for API events and were never used by CallbackHandler-1.0.
Your callback signature should match the arguments passed to callbacks:Fire(). Here is your code fix:
function EPGPreserves:MassEPAward([b]event, awarded, reason, amount[/b])
self:Print("Mass award caught!")
I tried that code Adirelle, but it gives me the same error:
[FONT=Courier New]EPGPreserves-0.0.1\core.lua:13: attempt to concatenate local 'awarded' (a table value)[/FONT]
I checked the callbackhandler for the relevant code that calls the function but so far it is unclear to my why the extra arguments aren't passed.
The "table value" seems to imply that the 2nd argument contains a table with the values in it; but getting the values from the table has been unsuccesful so far- the callbackhandler code just seems to pass the arguments along so I'm confused here.
Thanks for the help. You can slap me with the n00b-stick. After checking the firing function it appears the "awarded" is a table with all the players who received the award.
I assumed that the "awarded" parameter would contain the instance name (as the three things you can set in EPGP are 'instancename' 'reason' and 'amount'). So much for making assumptions without checking.
Again, thanks for the help- I learned something valuable here ;)