Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
(Adding documentation for AddonLoader)
 
(Added download links)
Line 1: Line 1:
 
{{Addon}}
 
{{Addon}}
 
AddonLoader is a load manager, which can be used by addons to load them conditionally. For example an addon that only manages a Hunter's pets does not ever need to be loaded on a non-Hunter. AddonLoader allows the developer to specify certain load conditions for their addons, allowing them to be intelligently loaded on demand.
 
AddonLoader is a load manager, which can be used by addons to load them conditionally. For example an addon that only manages a Hunter's pets does not ever need to be loaded on a non-Hunter. AddonLoader allows the developer to specify certain load conditions for their addons, allowing them to be intelligently loaded on demand.
  +
  +
==Download==
  +
  +
AddonLoader can be downloaded at the following locations:
  +
  +
* [http://wow.curse.com/downloads/wow-addons/details/addon-loader.aspx Curse.com]
  +
* [http://www.wowinterface.com/downloads/info11476-AddonLoader.html WowInterface.com]
   
 
==Usage (as a player)==
 
==Usage (as a player)==

Revision as of 23:19, 16 February 2009

AddOn
AddOn article
This page describes fan-made scripting using the World of Warcraft API which has had notable impact on the game's development/history.

AddonLoader is a load manager, which can be used by addons to load them conditionally. For example an addon that only manages a Hunter's pets does not ever need to be loaded on a non-Hunter. AddonLoader allows the developer to specify certain load conditions for their addons, allowing them to be intelligently loaded on demand.

Download

AddonLoader can be downloaded at the following locations:

Usage (as a player)

Simply having AddonLoader present should cover your needs. There are some options that can be accessed through /addonloader for overriding an addon's load condition.

Usage (as a developer)

Special Fields

## X-LoadOn-Events: UNIT_SPELLCAST_START, UNIT_MANA
## X-LoadOn-UNIT_SPELLCAST_START: if arg1 == 'player' then AddonLoader:LoadAddOn('MyAddOn') end 
## X-LoadOn-UNIT_MANA: if arg1 == 'player' then AddonLoader:LoadAddOn('MyAddOn') end 

Specify events to register for. You must specify event reaction code for each event.

## X-LoadOn-Hooks: GameTooltip_SetDefaultAnchor, ChatFrame_OnEvent

Specify functions that are to be securely hooked. Other than that, works like Events above.

## X-LoadOn-Execute: ChatFrame1:AddMessage('MyAddOn is present, but not yet loaded')

This code will execute on login regardless of if the addon is loaded or not. Use this if you need to specify complicated loading circumstances like function hooks. Note that toc fields are limited to about 1000 characters, if you must go over that amount, use X-LoadOn-Execute2 etc. Multiples get concatenated together and executed as one.

## X-LoadOn-Slash: /myaddon, /myadd

This specifies a slash command to register when your addon is not loaded. When the command is used by the player, your addon will be loaded, then the typed command will be issued again, so that options can be accessed if your addon's load condition hasn't yet fired.

## X-LoadOn-LDB-Launcher: Interface\AddOns\myAddon\icon
## X-LoadOn-LDB-Launcher: Interface\AddOns\myAddon\icon myAddonLauncher

This works similar to the slash loader, except with LDB launchers. AddonLoader will create an LDB launcher for your addon and set it's OnClick action to load your addon, then call the new OnClick handler your addon creates. This also means your addon must handle the LDB dataobj carefully, to ensure it is declared correctly for users with and without AddonLoader installed.

local ldb = LibStub:GetLibrary("LibDataBroker-1.1")
local dataobj = ldb:GetDataObjectByName("myAddonLauncher") or ldb:NewDataObject("myAddonLauncher", {type = "launcher", icon = "Interface\\AddOns\\myAddon\\icon"})
dataobj.OnClick = function(self, button) dosomethingonclick(button) end

The second arg is optional, if not present your addon's name will be used for the dataobject name. Also note that texture paths in the TOC use "\" while paths declared in lua must use an escaped "\\"

Load Conditions

## X-LoadOn-<tag>: <value(s)>
Tag Value(s) Description
Always true Load the addon unconditionally, use this to allow users to specify override behavior.
Always delayed Load the addon unconditionally, after the player has entered the world. Addons flagged delayed will get loaded sequentially on a timer, thereby reducing initial load time.
AuctionHouse true Load the addon when you go to the auction house.
Arena true Load the addon when you zone in to an arena.
Bank true Load the addon when you open your bank.
Battleground true Load the addon when you zone in to a battleground
Class Priest, Paladin, Druid Load the addon if the player is one of the specified classes. Note: only use English class names, comma-separated
Combat true Load the addon when you enter combat.
Crafting true Load the addon when the enchanting or tradeskilling frames are opened.
Group true Load the addon when you join a party or raid.
Guild true Load the addon if you are guilded.
Instance true Load the addon when you enter any PvE instance.
Level 35 Load the addon if the player is exactly level 35.
Level 25- Load the addon if the player is under or at level 25.
Level 56-60 Load the addon if the player is between 56 and 60 (inclusive)
Level 65+ Load the addon if the player is at or above level 65.
Mailbox true Load the addon when you open the mailbox.
Merchant true Load the addon when you're at a merchant.
NotResting true Load the addon when you aren't resting.
PvPFlagged true Load the addon when you are PvP flagged.
Raid true Load the addon when you join a raid.
Resting true Load the addon when you're resting.
Zone Duskwood, Stranglethorn Vale Load the addon when the player is in one of the specified zones. Use english zone names only, comma-separated