View Single Post
12-12-20, 08:35 AM   #8
Krainz
A Wyrmkin Dreamwalker
Join Date: Oct 2016
Posts: 57
I'm trying to debug this so I can learn how to handle an event properly

I put the covenant event handler within a code that disables spell activation overlay just to see how it works

Lua Code:
  1. local addon, ns = ...
  2.  
  3. local f = CreateFrame("Frame")
  4. f:RegisterEvent("PLAYER_ENTERING_WORLD")
  5. f:RegisterEvent("PLAYER_REGEN_ENABLED")
  6. f:RegisterEvent("COVENANT_CHOSEN")
  7. f:SetScript("OnEvent", function(self, event, ...)
  8.     if event == "PLAYER_ENTERING_WORLD" then
  9.         SetCVar("displaySpellActivationOverlays", 0)
  10.         SetCVar("nameplateShowAll", 0)
  11.     elseif event == "PLAYER_REGEN_ENABLED" and not IsAddOnLoaded("ConsolePort") then
  12.         SetCVar("nameplateShowAll", 0)
  13.     elseif event == "COVENANT_CHOSEN" then
  14.         print("Hello World! Hello " .. event);
  15.     end
  16. end)
  17.  
  18. local function eventHandler(self, event, ...)
  19.  print("Hello World! Hello " .. event);
  20. end
  21. f:SetScript("OnEvent", eventHandler);
  22.  
  23. if (MouseIsOver(MacroButton)) then
  24.    -- do something
  25. end
  26.  
  27. if (MouseIsOver(MacroNewButton)) then
  28.    -- do something
  29. end

The only message I get in-game is

Code:
11:33:15 | Hello World! Hello PLAYER_ENTERING_WORLD
Shouldn't I be getting a Hello COVENANT_CHOSEN?
  Reply With Quote