Talk:Addon Tutorial

Copied this code straight to toc, lua, and xml files, and it doesn't seem to do anything in-game. No 'Hello World!' message in my chat window at any point. Did anyone actually test this?

I am at the very beginning stages of programming and am seeking answers. I have created the .toc and .lua files but unlike the .xml file, I do not have a program to open them with. My question is what program do I use to edit the toc and lua files. Do I edit them in notepad or do I download the lua language? I have done simple java and python programming before.

I would look at something like Notepad++ It's very good for most languages --Satire 22:17, 20 February 2009 (UTC)

Follow-on
Is there a follow-on for the Tutorial?

At the very least, we might want to list function and object references here or the link to the page that shows them. &rarr;Torin23 02:23, 18 April 2009 (UTC)

>>>Update from visitor. 10/4/2009<<< This site does list functions, events, etc.. Go here http://www.theromwiki.com/index.php/Main_Page and look in the bottom right under AddOn Guides.

I thought this tutorial http://www.theromwiki.com/index.php/Addon_Tutorial was solid! Very good for starters. BTW you can basically copy and paste to make it work. In fact, in the game create a macro and script it as [ /HelloWorld show ]and another as [ /HelloWorld hide ] without these [] to test this.

Also note you need to have HelloWorld.xml before HelloWorld.lua as instructed.

I would pay $$ to see tutorials on working with frames, layers, etc ..and developing the UI. I understand functions and events (and registering events) and all the fundamentals of programming. My dilema is there is no API documentation available. Even the link above lacks in description and examples. Can someone...anyone...please post a simple example of creating frames, layers, and using templates???

I found this http://www.wowwiki.com/HOWTOs for WOW, which is ok...but, nothing in it actually allows you to create a working example, it's just tips and examples. Also...its WOW...very similar to what ROM is doing...but again, without any API docs..man! I would love nothing more than to get some examples so I can put together better info. Please HELP us dev dudes. :-)

@Satire
You can edit .toc, .lua, and .xml files all with Notepad++. You don't need anything else but your text editor. (Notepad++ also supports Syntax Highlighting for lua and and much more)

As for it not working, I don't know. I have not tested and don't really have the time atm, but you could look @ a really simple addon to learn the same thing.

My AddOns ChatScroll and RollFrameMove are quite simple, not too much code to look at. You could use them as an example.

For example with Events
keep in mind code with event will not work, if you put

HelloWorld.lua

before

HelloWorld.xml

in .toc file

--

I think it does... my addon works with the .lua before the .xml in the toc

For example with timer
Quote:

You can stop OnUpdate from firing by calling frame:Hide and starting it again with frame:Show.

You can't as long, as word "local" staing before "frame = _G.HelloWorld_Frame" xD

Frame example doesn't work?!
Hello, i copied an example of frame and putted in .xml file, made an .toc file and loaded the game - frame didn't appears... why?

i think - found... because i COPIED... sometimes copied code doesn't work ;(

Frame manipulation from LUA code
i think there is another subject we may add to this page. How to manipulate XML from lua script.

You can access all CML elements by name, for example "width, height = MyAddon_MainFrame:GetSize" stores frame's size into the variables, and "MyAddon_MainFrame:SetSize(width, height)" will change the frame's shape.

Also this is useful for internationalization and localization, allowing you tu change labels and buttons texts for diferent languages.

MyAddon_MainFrame_Title:SetText("new Title") may change the frame titel text.

BUT:
 * how to reload the frame to show the changes?
 * how to access all the atributes: position, size, text, scripts, etc? What are the list of funtions you can use on XML elements?

Can you help?


 * It is updated automatically. List of all methods for getting/setting the attributes can be found here List of Widget Methods - Fseplnixx (sorry for bad english sometimes :) ) 10:42, 22 October 2011 (UTC)

Getting Item Information
I am using GetBagItemInfo(i) to read items from the Backpack. This works well for getting the item name, but is there a way to get a more in depth description of the item?

I.e. If I read in a Random Fusion Stone, I get the name of the item, which is the string "Random Fusion Stone", but is there also a way to receive the item's stats? Like command I, Whiff I...etc

The current syntax I am using to read the item is:

local index, texture, name, itemCount, locked, invalid = GetBagItemInfo(i);