WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Looking For a Guide (https://www.wowinterface.com/forums/showthread.php?t=32564)

MrLulz 05-17-10 10:43 PM

Looking For a Guide
 
With my newest addon I am working on I've decided it's time to start including some options.

I'm hoping someone can point me in the direction of an up to date guide of some sort to help with slash commands and/or interface options.

Anyone know of a good one? :)

alimjocox 05-18-10 05:38 AM

slashcmds you can do this..

Code:

local function doThisFunction()
        print("pewpewrawr")
end

SlashCmdList['EXAMPLE'] = doThisFunction
SLASH_EXAMPLE1 = '/exampleslash1'
SLASH_EXAMPLE2 = '/exampleslash2'

this is limited tho, i used NugRunning to help me with slashcmds that have a variable.

nightcracker 05-18-10 05:56 AM

This is not limited at all!

Code:

local function slash(arg)
        print(arg or "No arguments given.")
end

SlashCmdList["EXAMPLE"] = slash
SLASH_EXAMPLE1 = "/exampleslash1"
SLASH_EXAMPLE2 = "/exampleslash2"


Ailae 05-18-10 08:24 AM

Wowwiki has a short guide on creating slash commands.

http://www.wowwiki.com/Creating_a_slash_command

Fodaro 05-18-10 08:33 AM

I think it depends how many options you want to have. Consolid8 (my chat addon) just has a few, so I use slash commands. The simplified handler goes something like this:
Code:

SlashCmdList["CONSOLID"] = function(msg)
        msg = string.lower(msg)
        if msg == "report" then
                Consolid8.Report()
        elseif msg == "show" then
                Consolid8.Show()
        -- ...
        else
                print("Command not recognized.")
        end
end

If you have a lot of commands, you may wish to use a table, e.g.:
Code:

switches = {
        report = Consolid8.Report,
        show = Consolid8.Show,
        -- ...
}

SlashCmdList["CONSOLID"] = function(msg)
        msg = string.lower(msg)
        if switches[msg] then
                switches[msg](msg)
        else
                print("Command not recognized.").
        end
end

To use the interface options, it's just a case of creating a frame and using an API function to register it, although I haven't done it personally.

MrLulz 05-19-10 06:58 PM

Thanks for all of this. Anyone know of a good place to look for saving and calling variables so I can save some settings to go along with this? :)

Seerah 05-19-10 07:49 PM

http://www.wowwiki.com/Saving_variab..._game_sessions


All times are GMT -6. The time now is 04:11 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI