AddonManager

AddonManager v1.10 Addons

AddonManager helps you keep track of your addons and provides easy ways to access them.

It has a main window that lists all registered addons and their details, as well as a "Mini-Addon bar", where small addon icons can go.

The more addon developers that use it (and it's really easy to use!), the more addons will show up in the list. Give it time =)

For users

  • Type /addons to see all your registered addons
  • Alternatively, click on the AddonManager button in the "Mini Addons" bar

For addon developers

Registering your Addon

  • Add a call to AddonManager.RegisterAddon / RegisterAddonTable in your VARIABLES_LOADED event
  • Example1. At minimum, you can do this:
    if AddonManager then
        AddonManager.RegisterAddon("MyAddonName", "My addon makes you awesome")
    end
  • Example 2. Using a custom icon, a config frame, and a mini-addon button:
if AddonManager then
    local addon = {
        -- Information
        name = "MyAddonName",
        version = "v0.01",
        author = "Me",
        description = "My addon makes you awesome",
        icon = "Interface/Addons/MyAddon/myAddon32.tga",
        category = "Other",
        slashCommand = "/myaddon",

        -- Config-Frames
        configFrame = MyAddonConfigFrame, 
        disableScript = MyAddon_Disable,
        enableScript = MyAddon_Enable,

         -- Mini Button
         mini_icon = "Interface/Addons/MyAddon/myAddon32.tga",
         mini_icon_pushed = "Interface/Addons/MyAddon/myAddon32.tga",
         mini_onClickScript= MyAddon_Action,
         -- miniButton = MyAddonMiniButton, -- (obsolete but still valid - see below)
    }
    AddonManager.RegisterAddonTable(addon)
end
  • Of course, replace "my addon" with your addon
  • I recommend not printing out that your addon has loaded if you use AddonManager, since the user will be able to see it in the AddonManager list.
  • In the first example, your addon would be considered a "Passive" addon - its text would be colored green (like passive skills) and you can't click on it.

AddonManager.RegisterAddon

AddonManager.RegisterAddonTable = function(addon)  -- Since v1.042

AddonManager.RegisterAddon = function(name, description, icon, category, configFrame, slashCommands, miniButton, onClickScript, version, author, disableScript, enableScript)

Registers an addon with AddonManager. Adds the addon to the addons list and potentially also to the mini-addons-frame.

Parameters:

  • name - Your addon's name. Default is "[No Name]".
  • description - A brief (one or two sentence) description of your addon. Something that fits in a tooltip.
  • icon - Path to a 32x32 image icon (e.g., "Interface/Addons/AddonManager/Textures/addonManagerIcon32.tga"). If no icon is specified, will use default "recipe" icon.
  • category - One of AddonManager.Categories; will be used for filtering the addons list. Default is "Other". One of Development, Economy, Information, Interface, Inventory, Leveling, Map, PvP, Social, or Other.
  • configFrame - If your addon has a config frame or other frame you want to show when your addon is clicked, use this.
  • slashCommands - Specify any slash commands you've registered so that the user doesn't have to remember them.
  • miniButton - If you want to display a button on the "Mini-Addons" bar, specify it here.
  • onClickScript - If you need to special handling when your addon's button is clicked, you can specify a script for it. If this parameter is specified, configFrame is ignored.
  • version - what version this addon's in
  • author - who made this addon
  • disableScript - A script that can be used to disable your addon. Adds the disable option in the AddonManager list if both disableScript and enableScript are specified
  • enableScript - A script that can be used to re-enable your addon

The Mini-Addon Bar

  • the old extra XML Button definition is obsolete!
  • you may still use it if you require special button handling
  • Example:
    <Button name="MyAddonMiniButton" hidden="true" inherits="UIPanelButtonTemplate" parent="AddonManagerMiniFrame">
		<Size>
			<AbsDimension y="24" x="24"/>
		</Size>
		<Scripts>
			<OnClick>
				AddonManager.MiniButton_OnClick(this)
			</OnClick>
			<OnEnter>
				AddonManager.MiniButton_OnEnter(this)
			</OnEnter>
			<OnLeave>
				AddonManager.MiniButton_OnLeave(this)
			</OnLeave>
		</Scripts>
	    <NormalTexture file="Interface\AddOns\MyAddon\myAddonIconNormal.tga"/>
	    <PushedTexture file="Interface\AddOns\MyAddon\myAddonIconDown.tga"/>
	</Button>
  • The only things you should change here are the Button's name and the two textures.
  • Note that you can't have a MiniButton if your addon is passive (because what should happen when the user clicks on it?). A passive addon is one that has no config frame and no custom onClickScript.

List of sample Registrations

You must login to post a comment. Don't have an account? Register to get one!

  • 9 comments
  • Avatar of NizuKazushi NizuKazushi Apr 23, 2011 at 23:09 UTC - 0 likes

    @nbanyan: Go theres a way to add this fature for addon developers by themself after using the function AddonManager.RegisterAddon ore AddonManager.RegisterAddon place the code sample:

    for i, v in ipairs(AddonManager.Addons) do
    	if (AddonManager.Addons[i].name=="<yourAddonName>") then
    		AddonManager.Addons[i].enabled=<SavedSettingsOfYorAddon>
    	end
    end
    

    yourAddonName => is the name of you Addon placed in the function AddonManager.RegisterAddon ore AddonManager.RegisterAddon

    SavedSettingsOfYorAddon => true/false

  • Avatar of NizuKazushi NizuKazushi Apr 23, 2011 at 22:09 UTC - 0 likes

    @NizuKazushi: Go

    @nbanyan: Go

    oh i see its allredy been posted by nbanyan

  • Avatar of NizuKazushi NizuKazushi Apr 23, 2011 at 22:07 UTC - 1 like

    pls replace

    addon.enabled = true
    

    in the function RegisterAddonTable() with:

        if (addon.enabled==nil) then
    	addon.enabled = true
        end
    

    to give addon Developers the possibility to choose and save the settings of the addon enable beeing. <<sorry for my english hope its understandable

  • Avatar of frafall frafall May 31, 2010 at 12:37 UTC - 0 likes

    I've done a small integration of addonmanager to Romba, is this something you are interested in including in the addon?

    -frafall

  • Avatar of Mavoc Mavoc May 06, 2010 at 05:03 UTC - 0 likes

    If this is still alive can we get an option to display the translator as well as the author

  • Avatar of veterochek veterochek Mar 24, 2010 at 12:50 UTC - 0 likes

    Does projest still alive?

  • Avatar of nbanyan nbanyan Nov 05, 2009 at 06:45 UTC - 0 likes

    I've a small feature request:
    In the AddonManager.RegisterAddonTable function, could you give us the option of setting the addon.enabled variable instead of assuming it's 'true'
    This would allow us to save the enabled/disabled state so mods can stay disabled even after restarting the client.
    This would be especially useful for mods that perform core operations in response to the LOADING_END event.

    Last edited Nov 05, 2009 by nbanyan
  • Avatar of gastroneunzehn gastroneunzehn Mar 26, 2009 at 09:41 UTC - 0 likes

    N1 Addon.

    But plz fix description.

    slashCommands = "/myaddon",
    
    addon.slashCommands,
    

    MfG:Gastro

  • Avatar of shadecut shadecut Mar 17, 2009 at 18:45 UTC - 0 likes

    Please add your addon.onClickScript handling from

    AddonManager.OnAddonClicked = function(btn, id)
        local addon	= AddonManager.GetAddonAtIndex(id)
        if addon.onClickScript then
            addon.onClickScript(btn, id)
            
        elseif Sol.util.IsValidFrame(addon.configFrame) then
            ToggleUIFrame(addon.configFrame)
            GameTooltip:Hide()
        end
    end
    

    to AddonManager.MiniButton_OnClick

    nachtgold

  • 9 comments

Facts

Date created
Mar 06, 2009
Categories
Last update
Mar 20, 2014
Development stage
Release
Language
  • enUS
License
Creative Commons License By-Nc-Sa 3.0
Curse link
AddonManager
Reverse relationships
10
Downloads
184,022
Recent files

Authors