Thread Tools Display Modes
03-15-11, 09:31 AM   #1
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Personal Addon Not Loading...

Hello. I'm having a simple problem which I hope has a simple solution. My addon is not loading.
  • I have even tried putting
    Code:
    print("hi")
    at line 1 of the addon, and it won't even run that bit of code.
  • I have tested the code by putting it in another (Ace3-based) addon's lua and just running my module out of it. But when I isolate the module into its own (non-Ace3) addon, it does not seem to respond. I took care to ensure there aren't any references/embeds/dependences on Ace3.
  • My isolated module shows up in my AddOns list in-game, and I am able to click the "enable" box.
  • I've noticed that ever since I made this addon, the load times on the launcher and the loading of wow.exe in general has slowed considerably. Whereas it was a second before, it takes about 10 seconds now.
  • I have run the code through an lua debugger, and I'm confident the grammar and logic are both sound, so I think this has to be something syntactical.
  • I have followed the basic wowwiki guides to creating one's own addon, as far as the naming of files as well as the .toc


Any help with this would be greatly appreciated! Thank you.
  Reply With Quote
03-15-11, 09:44 AM   #2
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Mind posting the code? without seeing whats going on i cant tell you why its not working.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 09:47 AM   #3
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
The code is almost 1200 lines long. Is there any particular chunk you'd be interested in?
  Reply With Quote
03-15-11, 09:52 AM   #4
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
well what does your addon do exactly? Since you cant get it to even print lets start with the .toc file you have setup and go from there.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 09:56 AM   #5
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Here is the TOC

Code:
## Interface: 40000
## Title: Kenshone Quant Frames
## Notes: Ohai
## Author: Kenshone / Quantark US-Blackrock
## Version: Release 1.0
## DefaultState: Enabled
## SavedVariables: kenshoneEX,kenshoneWHY

KenshoneQuantFrames.lua
My addon has several functions. It will:
  • Parse the combat log and give certain notifications on certain combat log events
  • Create statusbars frame which will track the hp of NPC enemies of my raid.
  • Create another statusbars frame which will track innervates available within my raid.


I have to talk to a customer for a bit so I'll be back in about 20 minutes. Thanks!
  Reply With Quote
03-15-11, 10:02 AM   #6
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
For starters remove the DefaultState part unless you intended it to be a Load on demand addon? Normally you only use that DefaultState part if your addon is going to be load on demand and normally it would be set to disabled so that the addon only loads when its information is requested by another addon. You want it to load up and do its thing all the time though correct? If so start with removing that and then see if your print function works when you log into wow. Then well move on to the rest of the code. to post a large chunk of code like that i use www.pastey.net if you want to go there and post your code and come back and post the link to it. very easy to use site.

edit - i would also remove the word release from the version entry. although that should work and will display in places as you intended it to... for other things you may do later it is a better practice to use only numbers and decimals there. Should you later decide to use that version number for some reason it will be easier to compare it to another value or string if it is all numerical.

another edit - if you are deadset on having the version mark release/alpha/beta i would use just a single letter r/a/b. Again for easier comparison later.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-15-11 at 10:25 AM.
  Reply With Quote
03-15-11, 10:33 AM   #7
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
When your addon does not show the "hi" it is not loaded.
Check that your AddOn-Folder and the basepart of your AddOn have the same name.

Interface\AddOns\MyAddOn\MyAddOn.toc

Try to have it casesensitiv.
See WoW\Logs\FrameXML.log for problems related to loading your files.
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
03-15-11, 10:34 AM   #8
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Well, I modified the TOC file, but unfortunately I can't log into WoW until I get home from work in about 9 hours. In the meanwhile, here is the link to the pastey:

http://www.pastey.net/147540-47x4
  Reply With Quote
03-15-11, 10:44 AM   #9
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
I dont see any immediate problems. Wow is still down for maintenance so even if you could get on now it would do you no good lol. When it comes up i will do a quick check and see what happens and if the code fires errors or not.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 10:49 AM   #10
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Grim I'd greatly appreciate that. Thank you.

I was contemplating adding an ADDON_LOADED eventhandler, but it doesn't seem necessary in some of the other addons I've seen.
  Reply With Quote
03-15-11, 10:50 AM   #11
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Your "hi" print is executing - it's doing so before you're even in-game and before the ChatFrame is even loaded.

Nothing is happening because your "events" table doesn't exist, so the iteration over it to register the events does nothing. I'm assuming you meant to use your "eventsK" table, which is empty so would behave identically.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
03-15-11, 11:01 AM   #12
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Indeed, i didnt notice there was no actual events anywhere. EventsK should be populated at some point with the events you want to have it respond to. all of the print("hi") functions are happening but as Torhal said they are happening before the game loads you into it. Those print functions need to come after the event ADDON_LOADED maybe even after the event PLAYER_ENTERING_WORLD
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 11:12 AM   #13
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Here is my event handling from the core file of my UI and then a few examples of how it is used in other parts of the UI.

Core File Function -
Code:
--[[-----------------------------------------------------------------------------
Event handling - Use one frame to process multiple individual OnEvent needs
-------------------------------------------------------------------------------]]
do
	local frame, select, next, events = CreateFrame('Frame'), select, pairs({ })
	local register, unregister = frame.RegisterEvent, frame.UnregisterEvent
	frame:Hide()

	frame:SetScript('OnEvent', function(self, event, ...)
		for reference, func in next, events[event], nil do
			func(reference, event, ...)
		end
	end)

	function addon.RegisterEvent(reference, event, func)
		if not events[event] then
			events[event] = { }
			register(frame, event)
		end
		events[event][reference] = func
	end

	function addon.RegisterEvents(reference, func, ...)
		local event
		for index = 1, select('#', ...) do
			event = select(index, ...)
			if not events[event] then
				events[event] = { }
				register(frame, event)
			end
			events[event][reference] = func
		end
	end

	function addon.UnregisterEvent(reference, event)
		if events[event] then
			events[event][reference] = nil
			if not next(events[event]) then
				events[event] = nil
				unregister(frame, event)
			end
		end
	end

	function addon.UnregisterAllEvents(reference)
		for event, registry in next, events, nil do
			registry[reference] = nil
			if not next(registry) then
				events[event] = nil
				unregister(frame, event)
			end
		end
	end
end
These are some examples of it being used.

On Show function that registers events to the party frames -
Code:
--[[-----------------------------------------------------------------------------
Register/Unregister events on Show/Hide
-------------------------------------------------------------------------------]]
local function OnShow(self)
	local register = addon.RegisterEvents
	register(self, UpdateDeadOffline, 'PARTY_MEMBER_DISABLE', 'PARTY_MEMBER_ENABLE')
	register(self, UpdateLeader, 'PARTY_LEADER_CHANGED', 'ZONE_CHANGED_NEW_AREA')
	register(self, UpdateName, 'UNIT_COMBAT', 'UNIT_FLAGS', 'UNIT_NAME_UPDATE', 'UNIT_THREAT_LIST_UPDATE', 'UNIT_THREAT_SITUATION_UPDATE')
	register(self, UpdatePower, 'UNIT_DISPLAYPOWER', 'UNIT_ENERGY', 'UNIT_MANA', 'UNIT_MAXENERGY', 'UNIT_MAXMANA', 'UNIT_MAXRUNICPOWER', 'UNIT_RAGE', 'UNIT_RUNIC_POWER')
	register(self, UpdatePvp, 'UNIT_DYNAMIC_FLAGS', 'UNIT_FACTION')
	register(self, UpdateQType, 'PARTY_MEMBERS_CHANGED', 'LFG_ROLE_CHECK_UPDATE', 'LFG_ROLE_UPDATE', 'PLAYER_ROLES_ASSIGNED', 'LFG_ROLE_CHECK_ROLE_CHOSEN', 'LFG_UPDATE_RANDOM_INFO', 'PLAYER_ENTERING_WORLD')
	register(self, UpdateUnit, 'PARTY_MEMBERS_CHANGED', 'UNIT_AURA', 'UNIT_HEALTH', 'UNIT_LEVEL')
	addon.RegisterEvent(self, 'UNIT_MAXHEALTH', UpdateHealth)
	if UnitFactionGroup(self.unit) == "Alliance" then    
		self.pvpIconFrame.texture:SetTexture("Interface\\GroupFrame\\UI-Group-PVP-Alliance.blp")
	elseif UnitFactionGroup(self.unit) == "Horde" then
		self.pvpIconFrame.texture:SetTexture("Interface\\GroupFrame\\UI-Group-PVP-Horde.blp")
	end
	UpdateUnit(self, "")
	if not addon.settings.movedFrames.GrimUIPartyFrame1 then
		addon:ResetPartyFrames()
	else
		local position = addon.settings.movedFrames[self:GetName()]
	if position then
		addon:UnlockFrame(self)
		self:ClearAllPoints()
		self:SetPoint(unpack(position))
		addon:LockFrame(self)
	end
	end
	
end
A more generic PLAYER_ENTERING_WORLD event registration to fire a slew of functions -
Code:
addon.RegisterEvent("PlayerFrame-Initialize", 'PLAYER_ENTERING_WORLD', function(self, event)
	addon.UnregisterEvent(self, event)
	addon:ConfigureBlizPlayerFrame()
	addon:ConfigurePlayerFrame()
    addon:PlayerFrameSetScale()
end)
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 11:13 AM   #14
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
fixed event registration

Code:
line 1185: 	for eventname in pairs(eventsK) do KenshoneMagic:RegisterEvent(eventname) end
It was my understanding that writing lines such as:

eventsK:ADDON_LOADED

or

eventsK:VARIABLES_LOADED

followed by line 1185 would populate the "eventsK" table appropriately.

Last edited by Kenshone : 03-15-11 at 11:17 AM.
  Reply With Quote
03-15-11, 11:18 AM   #15
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
just adding that wont fix it i dont think. You still need to make it populate EventsK with the events to respond to im not seeing anywhere that it does that.

eventsK:ADDON_LOADED i do not think will add ADDON_LOADED to the table if it will thats a new method to me

needs to look more like...
Code:
eventsK = {
"ADDON_LOADED",
"PLAYER_ENTERING_WORLD",
"SO_ON_AND_SO_FORTH",
}
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-15-11 at 11:23 AM.
  Reply With Quote
03-15-11, 11:37 AM   #16
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Hmm so your wrong torhal. I just loaded up print("hi") at the top of a file and it loaded it right up at the very top of the chatframe. as i thought the bliz stuff including chat frames are infact loaded and running when other addons get loaded.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]
  Reply With Quote
03-15-11, 11:40 AM   #17
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Line 8? local editbox = CreateFrame("EditBox", "MyAddOnEditBox", UIParent, "MyAddOnEditBoxTemplate")

"MyAddOnEditBoxTemplate" is not valid. EditBoxTemplate by itself may be though. Check and its not. I removed the template entry entirely and got it to fire up with out errors. If its working or not though im not sure.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-15-11 at 11:43 AM.
  Reply With Quote
03-15-11, 11:42 AM   #18
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Originally Posted by Grimsin View Post
Line 8? local editbox = CreateFrame("EditBox", "MyAddOnEditBox", UIParent, "MyAddOnEditBoxTemplate")

"MyAddOnEditBoxTemplate" is not valid. EditBoxTemplate by itself may be though.
I have no immediate use for that EditBox so that can be deleted.
  Reply With Quote
03-15-11, 11:53 AM   #19
Grimsin
A Molten Giant
 
Grimsin's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2006
Posts: 990
Okay so after messing with it for a few... there are some problems. One is that what ever you did with the edit box stuff breaks the chat edit box.

remove the local editbox = this that and the other as well as these two lines
editbox:SetText("/bwlcb 5 Life Grip Shadow Inf Target")
ChatEdit_SendText(editbox)

i see what you are trying to do with that and its not done quite right.
__________________
"Are we there yet?"

GrimUI
[SIGPIC][/SIGPIC]

Last edited by Grimsin : 03-15-11 at 11:56 AM.
  Reply With Quote
03-15-11, 12:00 PM   #20
Kenshone
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 19
Code:
eventsK = {
"ADDON_LOADED",
"PLAYER_ENTERING_WORLD",
"SO_ON_AND_SO_FORTH",
}
Hm, it'd be nifty if I could get the editbox to work...

But more importantly, event registration, does adding that chunk of code fix the Event Handling?

Last edited by Kenshone : 03-15-11 at 12:03 PM.
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Personal Addon Not Loading...

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