Talk:AddonLoader

From WowAce Wiki
Jump to: navigation, search

Problem with extending the spec

If a new condition is added and a new addon uses it, old AddonLoaders won't know about it and will not load the addon at all. What it SHOULD be doing is just loading it on startup to be safe.


Mikk's suggestion

X-LoadOn: combat
X-LoadOn2: [priority=5] always
X-LoadOn3: execute (lots of lua code here)
X-LoadOn3.1: (more lua code here)
X-LoadOn3.2: (even more lua code here)
X-LoadOn4: event SOME_EVENT_NAME

Always allowing [ ] before the condition name allows global tweaks on all conditionals as applicable:

  • priority, which takes an argument 1--9 for priority (1=highest) and makes addons load incrementally over time

The metadata fieldnames are generic in nature, so all future addonloaders will be able to scan them all and see if there's a setting type that they do not recognize. If so, they'll just load the addon immediately.

The LoadOnn.n approach allows all types of argument to scale to multiline in a generic way without hardcoding support for one specific type.

Additional benefit: a future UI that doesn't recognize a setting will still be able to show it as text

Adirelle's suggestion

I think there is 3 kinds of load conditions :

Simple conditions 
Always, in party, in raid, resting, at mailbox, at auction house, in combat...
Simple conditions with arguments 
Instance, classes, levels, zones, slash commands,
Complex conditions 
On event, or event purely lua-coded.

Moreover some addons may allow to delay their loading, depends on conditions or not.

I suggest to use one .TOC field for the simple conditions and another one for complex ones. And last a third field for delaying. Here some samples :

  • Simple conditions :
X-LoadOn: AuctionHouse
X-LoadOn: not Resting, Slash(/somecommand)
X-LoadOn: Party, Instance(any)
X-LoadOn: Instance(raid) and Class(mage,warlock)

The comma stands for "or". "and" and "not" are self-explicit.

  • Delayed loading :
X-DelayLoadOn: Always
X-DelayLoadOn: not Combat
  • Complex conditions
X-LoadOnAdvanced: event(SOME_EVENT_NAME): some lua code
X-LoadOnAdvanced: execute: some lua code


Discussion

  • How does this scale? You can't have multiple X-LoadOnAdvanced? And what if I want a delayed advanced? And what happens if I want a new type of conditional modifier (such as delayed), do we introduce more field types? (Back to the old problem, no?) --Mikk 16:23, 25 June 2007 (EDT)
    • I'm actually wondering if a really advanced load condition shouldn't be handled by a standalone loader. For the new modifier, I have to think more about it :p --Adirelle 16:32, 25 June 2007 (EDT)

Wishlist

  • Professions condition --Kergoth
  • Instance condition with group type argument --Adirelle
  • "On Bags" --Nymbia

How to do combined conditionals?

What if I'd like to do something along the lines of "If I'm in a raid, AND i'm level 70?"

  • X-LoadOn: raid
  • X-LoadOn2: [AND] level 70
  • X-LoadOn3: somecompletelydifferentcondition
  • X-LoadOn4: [AND] somethingelse

Doesn't extend that well with complicated AND/OR combos and whatnot but perhaps that should just be Execute territory? --Mikk 20:02, 24 June 2007 (EDT)