Wanting to Learn How: Addons, LUA, XML
So, lets a say someone who hasn't coded anything in many many years wanted to teach themselves how to make addons for WoW where would they begin? I have no knowledge of XML, just some basic HTML, coding was BASIC back in the 80's.
Any ideas? Help? Suggestions? (Other than don't bother) I'd really like to start trying to learn, as I have a lot of free time. |
The best start is to "steal" code :)
Grab some small addons that only have one function and look at the code. Some howtos http://www.wowpedia.org/HOWTO http://www.wowpedia.org/World_of_Warcraft_API Next you should get a good editor like notepad++ or sth. And when you've started come here with your problems to ask :) |
XML is the work of the devil in regards to addon coding, in my opinion (translate: IMO for you 1337 nerds out there).
Just with any language, start with the basics. WoWwiki has a decent startup guide here. Follow that up with the "HOWTO" sections for some more specific examples and tips/tricks. After that, start downloading some "simpler" addons out there and open them in notepad (or whatever editor of your choosing). Examine the code. Try to follow the function flows and see how they work. This, besides for the core basics in the "Getting started", is perhaps the best option for learning as it can show you a variety of ways to do similar things but in different structures. It's my firm opinion this is actually the best way to learn how to write addons for WoW (though not the best way to learn LUA in general). There are many others, myself included, that learned from the ground up just as you want to do. It does take some patience and dedication, but once everything "clicks", you'll find it's a lot easier than it looks. As with any coding language, the worst points are where coding can be tedious and repetitive. But in the end, you get a great feeling when it all works the way you wanted to. |
Except for some very specific examples you don't have to use XML for anything.
|
Quote:
I have found one MAJOR downside to XML that caused me to hate it; If you have any errors, your addon simply won't load. No loading = no error messages for debugging = useless. |
Quote:
j/k, but somebody had to say it. =P A good start is reading up on WoWPedia and WoWProgramming. WoWPedia has a fairly decent bit of information for starting out, and the WoWProgramming book is definitely worth it if you don't mind spending $50 or so on a rather large book (it's definitely worth it, though). http://www.wowpedia.org/Getting_star...writing_addons http://wowprogramming.com/ Quote:
Quote:
|
Where to begin?
Optionally, get on IRC: irc://chat.freenode.net #wowuidev, #wowace, #wowpediaReferences:
ps: "anything" that can be done with XML, can be done in Lua, so you don't really need to know XML to make an addon Quote:
|
Quote:
You can check your FrameXML.log file in the Logs folder for XML loading errors. Other than that, you can run the XML file through a compiler - the same kind that you would use to check web XML code through - to check for syntax errors. |
I really appreciate all the helpful replies and advice. It's great to see such a helpful and friendly community! :) I guess I have my work cut out for me starting tomorrow. :banana: Woo!
|
Quote:
|
So I have hit my first little snag.
IN another thread Phanx, kind soul that he is, gave me some simple instructions on how to fix a particular addon that is broken. He told me to change specific line numbers. So I installed Notepad++ and got to work. The one problem, Notepad++ line numbers and the ones Phanx gave me didn't line up. I eventually figured out that Notepad++ was adding blank lines between each line of the code. So my questions are:
|
_Any_ text editor that can open and save UTF-8/UTF-8 signature encoded files properly (along with ANSI, etc.) is "the way to go for editing LUA and XML".
Windows Notepad "can save" UTF-8 files, but its a giant hassle to work with. It can destroy files that originally have Unix or Mac newlines, below Vista it has problems with detecting Unicode, it has no line numbering, etc.. So basically, anything is better than it. Notepad++ is well regarded as its open source (free) and has a ton of features, plugins and so on. Also nice for LUA editing as it has plugins that can highlight, etc.. But as noted, its got a giant ton of features. Also has a good built-in help file along with tons of online resource help. If its too much for you, might want to ask if LUA editing/programming is really something you want to start doing. If you really (really) do want to program, a lighter weight text editor mentioned above that is actually my favorite for quick work: Notepad2 (also free). It has line numbers, doesn't add "random blank lines" and is considerably simpler to get started with. Other choices: Lua editors. |
The numbers she gave you are all correct for me using Notepad++, and I have never had issues with it. Are you certain that you are comparing to the correct files? You have to look at NameViolation.lua and NameViolation.xml
|
Quote:
|
You may have changed how line ending markers are handled. I've never seen an editor treat a Windows line ending (CR+LF) as a double line break (Unix is LF and Mac is CR), but I suppose it's possible. You can see the opposite effect in the default Windows Notepad when you open a file with Unix or Mac line endings; it won't show any line breaks at all.
I use Notepad2. It's small (618 KB executable) and fast, and not overburdened with a bunch of features that most people will never use or even know exist. The only downside is that it doesn't include syntax highlighting for Lua, but I find syntax highlighting annoying anyway, so I don't mind the lack. :p |
Quote:
|
Quote:
|
The most important feature I find in Notepad++ is really that when you select (highlight) a word (a variable name) or a number, it automatically also highlights the same word/number everywhere in the document.
This allows me to see where and how a variable is used within a function quickly, and assists greatly in the process of code understanding when reviewing code. It also helps immensely when refactoring code. Kinda wish Visual Studio will add this. |
Quote:
|
First project is Phanx walking me through fixing NameViolation, and its actually helping me some. I am sort of starting to get a basic idea of how LUA interacts with itself and XML. So I wanted to thank Phanx and all of you for the great advice and help here.
Next project will be as was suggested find a simple addon that does one thing and pick it apart, play with it (break it) and see how it works. :banana: |
All times are GMT -6. The time now is 04:35 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI