Quantcast WoWInterface - View Single Post - How do I learn making WoW mods?
View Single Post
03-28-06, 03:06 PM   #4
JIM the Inventor
A Cyclonian
 
JIM the Inventor's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2005
Posts: 42
The best piece of advice I can give is ... Take an AddOn that exists, is small, and does something distinctive. Make a copy of it and put the files in a safe place. Then open the originals and systematically destroy things.

I'm serious! Progressively enabling and disabling code is the way that a lot of programmers work. It's all about dividing big jobs into manageable pieces.

So ... in an XML file, you can carve out pieces of code by putting <!-- and --> around the sections you want to disable.

In a LUA file, you put --[[ and ]] around the sections you want to disable.

Example of an enabled function:

function HelloWorldofWarcraft(redAmount, greenAmount, blueAmount)

DEFAULT_CHAT_FRAME:AddMessage( "Hello world!", redAmount, greenAmount, blueAmount )

end
The same function, disabled:

function HelloWorldofWarcraft(redAmount, greenAmount, blueAmount)
--[[
DEFAULT_CHAT_FRAME:AddMessage( "Hello world!", redAmount, greenAmount, blueAmount )
]]
end
And the result within the game:

- If the AddOn formerly put "Hello world!" in your chat box, then it will stop doing so.
  Reply With Quote