-
Posted by nyxius on Fri, 10 Jun 2011 16:56:03
Hi, i've pretty much just started creating addons today, read some background around it, did a little addon that just printed some text, nothing fancy.
Creating my first addon, what i want it to do is add a specific player to my ignore list, the name is providied within the addon itself, lots of people are wanting this so they can't forget to add this player to their ignore list on alts.
Current lua file:
function Undeadbones() AddIgnore("undeadbones") print ("hi u") end
Current xml file :
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/ ..\..\FrameXML\UI.xsd"> <Frame name="AntiBonesFrame"> <Scripts> <OnLoad> print ("hi u") Undeadbones(); </OnLoad> </Scripts> </Frame> </Ui>
My toc file links up to both of these correctly, is there a simple mistake i have done here or a simple line i havn't added in, but looking for answers for a few hours and found squat, thanks for your help ;)
Edit 1. Typo Edit 2. Function name change
New News:
Print Statements have been added to both the lua and the Onload Scripts and both produce the correct statement
Nothing appears in the XMLFrameLog
-
Posted by jnwhiteh on Fri, 10 Jun 2011 17:02:41
Well a few things, your
<Script>
tag has an attribute ofFile
, which is not correct. It should befile
, the case does matter. Beyond that, without an error message its a bit difficult to say.Just get rid of
<Script>
and load the .lua file using the .toc file. -
Posted by nyxius on Fri, 10 Jun 2011 17:27:27
Getting rid of the line < Script File="Anti-Bones.lua"/>
I then put the code into a XML Validator
it outputted this
Line 6: element Scripts: Schemas validity error : Element '{http://www.blizzard.com/wow/ui/}Scripts': This element is not expected. Expected is one of ( {http://www.blizzard.com/wow/ui/}Size, {http://www.blizzard.com/wow/ui/}Anchors, {http://www.blizzard.com/wow/ui/}Animations ).
-
Posted by jnwhiteh on Fri, 10 Jun 2011 17:39:51
Yes, that doesn't mean there is an error. Ignore that.
-
Posted by Cayenne on Fri, 10 Jun 2011 17:40:22
It's great if you want to do this to learn how to write addons or maybe there's some improvement you'd like to make, but do you know there already exists an addon to serve this purpose?
-
Posted by nyxius on Fri, 10 Jun 2011 17:41:20
Edit.
-
Posted by Cayenne on Fri, 10 Jun 2011 17:42:17
The way you've posted it you say your code is in your toc file when it should be in your lua file... but you also say that your toc links them both so I'm guessing that's typo in the post rather than a problem with your code.
-
Posted by nyxius on Fri, 10 Jun 2011 17:43:23
Yes it's a typo, i meant to say that's what it's in the lua file, i'll edit it now, thanks
-
Posted by Cayenne on Fri, 10 Jun 2011 17:44:09
Your XML calls a function called
Anti-bones()
but the function you've defined isUndeadbones()
-
Posted by nyxius on Fri, 10 Jun 2011 17:45:07
It's great if you want to do this to learn how to write addons or maybe there's some improvement you'd like to make, but do you know there already exists an addon to serve this purpose?
It doesn't do what i want it to do, you have to login and them manually to make that work, where as my addon will ignore as soon as you login without any labour required
-
Posted by nyxius on Fri, 10 Jun 2011 17:47:45
Your XML calls a function called
Anti-bones()
but the function you've defined isUndeadbones()
Thanks, changed this but still doesn't solve the problem =/
-
Posted by jnwhiteh on Fri, 10 Jun 2011 17:51:46
Follow the troubleshooting steps I outline in the book:
- Check the Logs\FrameXML.log file and see if there are any recent entries that mention your addon.
- I suspect the name of the frame is invalid, you should not use '-' or any other non-alphanumeric characters in the name of a frame.
- Add a print statement to your OnLoad script and see if its being executed.
- Add a print statement to the function in your Lua file and see if its being executed.
Some more information would be useful =)
-
Posted by Cayenne on Fri, 10 Jun 2011 18:15:02
Actually Friend & Ignore Share just has a misleading description. What it does is whenever you log onto a character, it saves all your friends and ignores and adds them to the list of any other character you log onto. You only have to log onto all your characters if you want it to immediately friend/ignore anyone on any of the lists, and it provides some manual functions for dealing with uncommon situations like more total friends than can fit in a friends list.
The relevant part is that adding someone once to an ignore list will add them automatically to all your ignore lists for any character you log onto without you having to do anything extra. However your addon adds people isn't likely to be less work than using the built in blizzard methods of ignoring someone.
-
Posted by nyxius on Fri, 10 Jun 2011 22:02:57
Sorry for that, Had to attend a raid and had to concentrate :)
Nothing is appearing the XMLFrameLog which has a relation to the Addon
there was a previous XMLFrameLog entry which stated this also, took the time to rename all my titles from "Anti-Bones" to "AntiBones"
There is nothing being executed if i add a print statement
-
Posted by nyxius on Fri, 10 Jun 2011 22:03:58
Aha, got it to execute the print statement in my lua file
-
Posted by nyxius on Fri, 10 Jun 2011 22:05:22
- Add a print statement to your OnLoad script and see if its being executed.
How would i go about doing this, The lua file print statement i understood but not too sure how i would go about doing this
-
Posted by jnwhiteh on Fri, 10 Jun 2011 22:10:39
The code in between
<OnLoad>
and</OnLoad>
is just Lua code. You can add print("Inside the OnLoad Script") there and it will print that when that happens. -
Posted by nyxius on Fri, 10 Jun 2011 22:14:19
The print statement is working for the onload and the lua file, so something wrong with the actual lua code itself as in the Addignore isn't doing what it's meant to be doing i guess
-
Posted by nyxius on Fri, 10 Jun 2011 22:40:17
Can anyone write down what the correct lua code for ignoring someone on login is? just want to check that the API listings were correct with the way that i am currently doing it
-
Posted by jnwhiteh on Fri, 10 Jun 2011 22:53:18
Please do not edit/remove your posts. It's not constructive and its very bad behaviour. I have restored all of your previous posts. If you have something to add to the conversation, then add it.
Download the look at the addon that Cayenne helpfully linked for you. It's almost certain that you're performing the AddIgnore too early. At the point your addon is loading, the game is not fully initialised yet. Specifically, if you want to do something on 'login', then you should register for the
PLAYER_LOGIN
event, which is normally used to indicate that most of the game/client data has been initialised and is available. I'm not entirely sure when the ignore list is sent down, you'd have to look at the addon linked to get more information.I suggest you work your way through the book in order to better understand how to develop an addon.
-
Posted by nyxius on Fri, 10 Jun 2011 23:02:59
Thank you very much, will do that now, will inform you when i have fixed it, thanks alot :)