View Single Post
07/04/14, 02:17 AM   #2
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
I noticed that you are registering the event before you defined the handler. So right now your code is registering nil as a event handler - not your code.
Edit: Actually it is registering whatever happens to be in the global variable "MyEventOnHit". I just asumed it would be nil.

This would be the proper order:
Lua Code:
  1. --Declare the handler
  2. local function MyEventOnHit( eventCode , result , isError , abilityName, abilityGraphic, abilityActionSlotType, sourceName, sourceType, targetName, targetType, hitValue, powerType, damageType, log )
  3.     lblCounter:SetText(sourceName..":"..abilityName)
  4. end
  5.  
  6. --Register then handler with the event
  7. EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

Also, it could be that a second event firing directly after the NPC event is overwriting the label. I would use d and .. to output the data into chat.
Lua Code:
  1. --Declare the handler
  2. local function MyEventOnHit(...)
  3.     --takes any amount of parameters and feeds them to d()
  4.     d(...)
  5. end
  6.  
  7. EVENT_MANAGER:RegisterForEvent( "tlw" , EVENT_COMBAT_EVENT , MyEventOnHit )

Last edited by zgrssd : 07/04/14 at 02:20 AM.
  Reply With Quote