Thread Tools Display Modes
12-30-11, 05:48 PM   #1
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
Question [Question] Incompatible Addon?

Hey guys,

I'm new to lua and WoW addon developing, so this question might be very simple or whatever ... I'm not an english native speaker, so please excuse me for the bad lang :-)

So ... A few days ago, someone asked me if I could write him an WoW addon with that he could find out the cooking recipes, he hasn't learned yet (jear, I already programmed in other languages, e.g. C#, Java and Objective C, so my friends thought It would be simple for me to write an WoW addon).
Well, I told him that I could risk a view at lua and the WoW UI and the next day I searched for a short WoW addon guide. The syntax seemed to be very easy and It didn't seem to be a problem. I thought about the algorithm (what was no bigger problem) and then I created a first solution ... Hm a solution, that doesn't really work :-P
At this point I wanna tell you, that I don't really know, how to run or call a script ingame, so I just tried something, that looks like crap - anyway I tried it and it doesn't work, so I need you guys to help me.
When I loggin into the game and click on the "Addons" button, there is the addon, I wrote, but a red text says, that this one is "Incompatible".
For better understanding, I attached you the files located in the addon folder "CookingPro" ... Only the "CookingPro.toc" I can't upload (?), anyway here is the content:

Code:
## Title: CookingPro
## Notes: Shows you the cooking recipes you need
## Author: Me
## Version: v1.0.0
Frame.lua
Frame.xml
Now, please help me ... would be pretty cool :-)

Kind regards, StudentenFutter
and greetings from germany :-D
Attached Files
File Type: lua Frame.lua (3.9 KB, 763 views)
File Type: xml Frame.xml (1.2 KB, 838 views)
  Reply With Quote
12-30-11, 07:24 PM   #2
tinyu
A Molten Giant
 
tinyu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 837
The problem is with your .toc file above ## Title you need to add

## Interface: 40300

You could also get your friend to look at ackisrecipelist.
__________________
"There's no such thing as too many addons."
Lothaer
Titan Dev Team Member.
  Reply With Quote
12-30-11, 07:29 PM   #3
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
Man, thanks for the fast reply ... will test it tomorrow .. ohm I mean today :-)
  Reply With Quote
12-31-11, 09:02 AM   #4
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
So, now I tested what you told me and I added this line to my .toc file. On the addon screen there is no "incompatible" message anymore but the addon still doesn't work ...
In my .lua file I integrated some chat commands to call the addon:
Code:
function Frame1_OnLoad()
 SlashCmdList["COOKINGPRO"] = COOKINGPROCOM;
 SLASH_COOKINGPRO1 = "/cp";
 SLASH_COOKINGPRO2 = "/cookpro";
 SLASH_COOKINGPRO3 = "/cpro";
end

function COOKINGPROCOM(command)
 if(command == "an") then
  Frame1:Show();
  print("CookingPro gestartet.");
 elseif (command == "aus") then
  Frame1:Hide();
  print("CookingPro beendet.");
 end
end
But when I type one of this commands in the chat a message tells me that this command would not exist.
Do you got any idea why that doesn't work?

Thanks for help and kind regards
  Reply With Quote
12-31-11, 05:14 PM   #5
Nephaliana
A Kobold Labourer
 
Nephaliana's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1
My guess... your OnLoad code never gets called causing the slash command to never be registered. I assume it isn't called because your XML file is malformed -- missing a </BackgroundInsets>.
  Reply With Quote
12-31-11, 07:02 PM   #6
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
Did you Look at the full Code? Well I don't really know but I thought, that the OnLoad Method will be called automatically on loading the frame when I registred it in the xml file ...
My god this text is terrible xD
  Reply With Quote
12-31-11, 08:21 PM   #7
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Check in the ui log that the xml loaded or not, I feel it may need some work. If it loaded and no errors then get back to us and I'll look into it.
  Reply With Quote
01-01-12, 08:03 AM   #8
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
Well, the LUA error ingame console doesn't show anything and the ui log I will check Today. Thanks for the clue
  Reply With Quote
01-01-12, 10:33 AM   #9
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
Usually Logs\FrameXML.log tells me when a .xml fails to load. It can help if it says it did.
  Reply With Quote
01-02-12, 12:49 AM   #10
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
First, it will be much easier to read and quickly understand your code if you use indentation properly (or at all).

Second, there are a few issues with your XML file:

On line 3, you have "<script ..." instead of "<Script ...". I'm not entirely sure that WoW XML is case-sensitive, but it probably is.

On line 11, you have another opening "<Anchor>" tag instead of a closing "</Anchor>" one.

On line 14, you have an opening "<BackgroundInsets>" tag, but no closing one to go with it. If you don't want any insets, just get rid of this line, or add a closing tag for it.

In your Lua file, you should move your recipe/spell list tables outside of the OnClick handler function, otherwise you are creating a new table every time you click the button. You also don't need to create a second frame in Lua, since you don't use it for anything. You also don't need to create your slash commands inside an OnLoad handler; just create them in the main chunk (outside of any function in the file).

Finally, I would strongly advise against using global names like "Frame1" or "Button1". Use something non-generic and easily identifiable, such as "CookingProFrame" or "CookingProButton".

Attached are your files with the above modifications. I also cleaned up a few other things that seemed inefficient.
Attached Files
File Type: xml Frame.xml (1.3 KB, 774 views)
File Type: lua Frame.lua (3.3 KB, 703 views)
  Reply With Quote
01-02-12, 01:50 AM   #11
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
You could also simply have him use Ackis Recipe List to find the cooking recipes he doesn't already know.
__________________
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
01-02-12, 06:55 AM   #12
StudentenFutter
A Murloc Raider
Join Date: Dec 2011
Posts: 6
@Phanx

Okay, thank you so much. I don't know how to express it in english but you helped me quiet a lot and showed me the errors I will try to avoid in future.

Also thanks to all replys ... I'm new here but this community seems to be pretty cool :-)

StudentenFutter
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » [Question] Incompatible Addon?


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