How to open and close wow addons

Apr 14, 2010 at 3:33 PM

I am making a small addon that allows me to add alliance to a black list by entering there name in a text box. This is so in the future when I run accross these individuals I can carry out my revenge if my level and gear allow me to. I am just trying to figure out how to open an addon from a slash command. I have it load and it will pop up when I first log in and I have an exit button that will close the application. How do I get it to re-open. I am familiar with coding structure with basic stuff ie C++ and HTML. However I am not use to using multiple files for programs ie .lua .toc etc etc. Any help would be greatly appreciated. Thanks.

Apr 15, 2010 at 9:45 AM

 

Setup a OnLoad event and add some thing like:

-- setup slash command
SlashCmdList["MYADDON"] = MyAddon_Commandline;        -- MyAddon_Commandline is a function to take care of the /command parsing.
SLASH_MYADDON1="/myaddon";    -- setup /myaddon as the command players will use to view options etc.

...etc

Then the function to parse the command line slash command looks something like:

function MyAddon_Commandline(args)
    local lowerargs = strlower(args);
    if(lowerargs == "debug") then
       -- we get here if the player typed /myaddon debug
    else
       -- show options here since the /myaddon was provided on its own.     
       MyOptions:Show();  -- if u have a xml file for your options screen you can show it like this
    end;
end;

Id also like to point you in the direction of http://wowprogramming.com/ since this is an excellent website for beginners.

Hope this helps a little.  Good Luck.

Apr 15, 2010 at 1:44 PM

Thanks alot man works great!

Apr 15, 2010 at 11:01 PM

Your welcome.