Thread Tools Display Modes
07-22-08, 03:57 AM   #1
Seglberg
An Aku'mai Servant
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 33
RegisterEvent API Ace3

I'm pretty new at addons and I've come across a slight roadblock.

When I use self.RegisterEvent(ZONE_CHANGED) I get an error that reads:

Interface\Addons\RepWatch\Core.lua:38:Usage: RegisterEvent("eventname"."methodname"): 'metholdname' - method 'ZONE_CHANGED' not found on self.

I have made sure I have the correct Ace3 Library Files, here is a snippet of my program:



Code:
RepWatch = LibStub("AceAddon-3.0"):NewAddon("RepWatch", "AceEvent-3.0", "AceConsole-3.0")

-------------------------------------
function RepWatch:OnInitialize()
	-- Called When the Addon is Loaded

	-- Register the Database
	RepWatch.db = LibStub("AceDB-3.0"):New("RepWatchDB", defaults, "Char")

	LibStub("AceConfig-3.0"):RegisterOptionsTable("RepWatch", options)
	self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions("RepWatch", "RepWatch")
	self:RegisterChatCommand("RepWatch", "ChatCommand")
end
-------------------------------------
-------------------------------------
function RepWatch:OnEnable()
	self:RegisterEvent("ZONE_CHANGED")
	self:Print("RepWatch Ver. 0.1 Loaded")
	self:Print("Type /RepWatch for Options")
end

Last edited by Seglberg : 07-22-08 at 04:01 AM.
  Reply With Quote
07-22-08, 04:17 AM   #2
Mera
Retired of WoW, In ESO :)
 
Mera's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 331
I think it's because you havent registered a function to run when ZONE_CHANGED is triggered, if you write

Code:
function RepWatch:OnEnable()
	self:RegisterEvent("ZONE_CHANGED")
end
you must have then

Code:
function RepWatch:ZONE_CHANGED()
end
or

Code:
function RepWatch:OnEnable()
	self:RegisterEvent("ZONE_CHANGED","mynewfunction")
end
and then

Code:
function RepWatch:mynewfunction()
end
__________________
If you need to reach me I'm in ESO, @class101 or "Fathis Ules i"
addons: SpamBayes, BrokerCPU
projects: ThunderBayes
Mera[xeh]? - La CroisadeEcarlate (wow)
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » RegisterEvent API Ace3

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off