Help with addon and accessing code feedback
Using what I can find in the wiki, I'm trying to create an addon that puts a message in the chatbox every time a character gains XP. I'm not proficient with Lua or XML but I've programmed for four years now and can muddle my through the wiki. I think I have a proper(though crude) addon, but it doesn't work at all. I looked at some code for other addons and I think I'm doing it right but the lack of tutorials and documentation make it hard to me to find out what I'm doing wrong on my own.
I'd also like to know if there's a way to get console output for addons or access to a debugger. If I could have error returned or be able to view my addon as it runs it would be very helpful Lua Code:
Code:
<GuiXml> |
I will try to post an example.
*edit* Here you go: lua Code:
http://code.google.com/p/zork-esoui/...rienceTest.lua On that note. The events are just to trigger. You get your XP via this: lua Code:
I will add that to the code. *edit2* Code is updated. Result: |
So what's the benefit of going through the chat system rather than just using d() for console output?
|
Thanks! That code is beyond the scope of my Lua knowledge, so I'm doing to do my best to use it to piece together an addon that works instead of copy pasting. I will keep it bookmarked as a reference for if I ever turn this into a more professional addon. This is mostly for self education and not producing a useful addon since I imagine there's already addons that do this and more. The only thing that confuses me is using inheritance and placing "addon:" before function names. I examined a couple other addons and didn't see that. Is there any major advantage to that? If not, I'd rather not mess with it.
|
@jqm
Nothing. But d() has conditions for emitting a table that one does not need here. When you call d() with a string it will call EmitMessage which does nothing but CHAT_SYSTEM:AddMessage(text). Which is what I do aswell. @Son of a Sailor I don't want to leak to many functions or variable to the global namespace. So first of all addon is a local object. Secondly everything I do should be encapsuled in my addon object. That is why I define functions on my addon object and not just local functions. But you could do that with local functions only aswell. There are different ways to reach the same goal. |
Can everything be done in Lua or is a call from the XML needed? I tried copying your Lua to have a control that I know works and it does not work either. (Tested by killing mudcrabs) Or something may be wrong with my client
|
Check:
http://www.esoui.com/downloads/info3...ienceTest.html If you are overleveled and get zero xp no event will fire. |
If I download that as its own addon it works perfectly, but if I copy the Lua file into my own addon it doesn't work. I may have completely gooned it and it's time to start over and start from a fresh addon
Edit: Well I'm dumb. I kept working on a Lua file that wasn't in the right directory. I didn't pay attention to the file path in Notepad++ and had the right one open while continually working on the wrong one. Now I'm getting error messages! Which is normally a bad thing but I'm just happy to get feedback from an addon I made |
Lol you will not believe how often that happens. ;)
|
Hmm, still having issues. I may just be doing something dumb again, but for now I'll just enjoy the rest of the beta and try again later. Once we get closer to release hopefully there'll be more documentation and tutorials.
Lua Code:
|
Change this line
Lua Code:
to this Lua Code:
/edit: because you're registering your event using the event manager and not on your addon object itself. |
Well I never got it to work. I'll just try again next beta test/release. Hopefully by then there's be better documentation and a decent tutorial or two. Right now the wiki doesn't have much more than the names of functions and events.
|
All times are GMT -6. The time now is 04:28 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI