View Single Post
12-23-11, 06:24 AM   #4
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Just an idea:

Code:
local f = ? -- FrameReference not sure of the name

f:RegisterEvent("PLAYER_ENTERING_WORLD") -- register the event to run after each loading screen

f:HookScript("OnEvent", function(f, event) -- we only add this to the current function, instead of replacing it entirely (then we match the event to be what we expect, before we run our code)
  if event == "PLAYER_ENTERING_WORLD" then
    local instanceType = select(2, IsInInstance())
    if instanceType == "pvp" or instanceType == "arena" then
      f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    else
      f:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
    end
  end
end)
  Reply With Quote