Personal Addon Not Loading...
Hello. I'm having a simple problem which I hope has a simple solution. My addon is not loading.
Any help with this would be greatly appreciated! Thank you. |
Mind posting the code? without seeing whats going on i cant tell you why its not working.
|
The code is almost 1200 lines long. Is there any particular chunk you'd be interested in?
|
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.
|
Here is the TOC
Code:
## Interface: 40000
I have to talk to a customer for a bit so I'll be back in about 20 minutes. Thanks! |
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. |
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. |
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 |
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.
|
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. |
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. |
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
|
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:
--[[----------------------------------------------------------------------------- On Show function that registers events to the party frames - Code:
--[[----------------------------------------------------------------------------- Code:
addon.RegisterEvent("PlayerFrame-Initialize", 'PLAYER_ENTERING_WORLD', function(self, event) |
fixed event registration
Code:
line 1185: for eventname in pairs(eventsK) do KenshoneMagic:RegisterEvent(eventname) end eventsK:ADDON_LOADED or eventsK:VARIABLES_LOADED followed by line 1185 would populate the "eventsK" table appropriately. |
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 = { |
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.
|
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. |
Quote:
|
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. |
Quote:
But more importantly, event registration, does adding that chunk of code fix the Event Handling? |
All times are GMT -6. The time now is 08:18 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI