WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   Firing events using Ace3 not working? (https://www.wowinterface.com/forums/showthread.php?t=55906)

Sweetsour 12-08-17 05:23 PM

Firing events using Ace3 not working?
 
I've been using Ace3 for a while and have a pretty solid understanding of how it and its mixins work. However, I'm trying to setup a new addon and I can't seem to get the event firings to work.

File Structure
Code:

[root_folder]
[Libs]
[AceAddon-3.0]
[AceConfig-3.0]
[AceConsole-3.0]
[AceDB-3.0]
[AceEvent-3.0]
[AceGUI-3.0]
[CallbackHandler-1.0]
[LibStub]
Ace3.lua
Ace3.toc
core.lua
AddonName.toc
embeds.xml

embeds.xml
xml Code:
  1. <Ui xmlns="http://www.blizzard.com/wow/ui/">
  2.     <Script file="Libs\LibStub\LibStub.lua"/>
  3.     <Include file="Libs\CallbackHandler-1.0\CallbackHandler-1.0.xml"/>
  4.     <Include file="Libs\AceAddon-3.0\AceAddon-3.0.xml"/>
  5.     <Include file="Libs\AceEvent-3.0\AceEvent-3.0.xml"/>
  6.     <Include file="Libs\AceDB-3.0\AceDB-3.0.xml"/>
  7.     <Include file="Libs\AceConsole-3.0\AceConsole-3.0.xml"/>
  8.     <Include file="Libs\AceGUI-3.0\AceGUI-3.0.xml"/>
  9.     <Include file="Libs\LibSharedMedia-3.0\lib.xml"/>
  10.     <Include file="Libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/>
  11.     <Include file="Libs\LibAboutPanel\lib.xml"/>
  12.     <Include file="Libs\AceConfig-3.0\AceConfig-3.0.xml"/>
  13. </Ui>

TOC File
Code:

## Interface: 70300
## Title: <Addon Name>
## Notes: <Addon Description>
## Author: Sweetsour
## Version: r01-beta
## SavedVariables: CCS_db_private
## SavedVariablesPerCharacter: CCS_db
## OptionalDeps: Ace3
## X-Embeds: Ace3

embeds.xml

core.lua

core.lua
Lua Code:
  1. local Crits = LibStub('AceAddon-3.0'):NewAddon(FOLDER_NAME, 'AceConsole-3.0','AceEvent-3.0');
  2.  
  3. function Crits:OnInitialize()  
  4.    
  5. end
  6.  
  7. function Crits:OnEnable()
  8.     print(FOLDER_NAME) -- This is printing fine
  9.  
  10.     self:RegisterEvent("PLAYER_REGEN_DISABLED")
  11. end
  12.  
  13. function Crits:PLAYER_REGEN_DISABLED()
  14.     print("Combat Started") -- Not printing
  15.  
  16.     self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  17.     self:RegisterEvent("PLAYER_REGEN_ENABLED")
  18. end
  19.  
  20. function Crits:PLAYER_REGEN_DISABLED()
  21.     self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
  22.     self:UnregisterEvent("PLAYER_REGEN_ENABLED")
  23. end
  24.  
  25. function Crits:COMBAT_LOG_EVENT_UNFILTERED(event,...)
  26.     print(event) -- Not printing
  27. end

Sweetsour 12-08-17 05:28 PM

It figures that the moment I post this, I immediately found the issue. I have PLAYER_REGEN_DISABLE() called twice. Changed the second one to PLAYER_REGEN_ENABLED() and everything works fine.

Ugh.


All times are GMT -6. The time now is 11:23 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI