Thread Tools Display Modes
05-03-22, 07:20 AM   #1
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
addon loading order.

I'm suffering from something in my UI that I cant seem to work out,...

here is the situation

Addon 1, Addon2

Addon 1: changes Resolution screen scale,
Addon 2: is a unit frames

if addon 2 loads before addon 1 then the frames are off and wonkie.

I need a way to ensure that Addon 1 is loaded before Addon 2

is there a way to do this, I'm growing frustrated, I have researched until blue in the face and I cant find anything on this issue.
__________________
  Reply With Quote
05-03-22, 08:27 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
What you can do is make sure you don't do any work in addon 2 until addon 1 has loaded. You can check for the addon loading stage using ADDON_LOADED event.


The way I do it is to monitor for when the active addon is loaded and any required addon is loaded during the ADDON_LOADED event. During that same event check stage I check to make sure all the addons that are needed to be loaded are loaded before progressing further.

Edit:

For example. This is a section from one of my nUI Plugins. To access the nUI stuff it needs to wait until nUI has loaded before doing its own work.

Lua Code:
  1. --[[ Create the InfoPanel Plugin ]]--
  2.     local plugin    = CreateFrame( "Frame", addon:GetInfoPanelName(), nUI_Dashboard.Anchor );
  3.     plugin.active   = true;
  4.  
  5.     --[[ Handle the addons Events ]]--
  6.     local function onEvent(self,event,arg1,arg2,arg3)
  7.         if ( event == "ADDON_LOADED" ) then
  8.             if arg1 == "nUI" then
  9.                 addon.nUILoaded = true
  10.             elseif arg1 == addonName then
  11.                 if not addon.nUILoaded then
  12.                     LoadAddOn("nUI")
  13.                 end
  14.                 addon.nUILoaded = IsAddOnLoaded("nUI")
  15.                 addon.addonLoaded = true
  16.                 addon.plugin = plugin
  17.                 addon:OnAddonLoaded()
  18.                 self:UnregisterEvent(event)
  19.             end
  20.         end
  21.     end

What this basically does is checks if nUI is loaded and set a flag. And check if the plugin addon is loaded. If nUI is loaded first, its just the case of waiting for the plugin to load. But if the plugin is loaded first you can force the base addon to load and check that it has loaded before proceeding. Hopefully it will help you see what you could do with your addon situation to work for you.
__________________

Last edited by Xrystal : 05-03-22 at 08:36 AM.
  Reply With Quote
05-03-22, 09:35 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Make addon 1 a dependancy of addon 2 in its .toc. Optional or Required depending on wether addon 1 may be installed or not.

## OptDeps: AddOn1
or
## RequiredDeps: AddOn1
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-03-22 at 09:39 AM.
  Reply With Quote
05-03-22, 09:56 AM   #4
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
ok maybe this will make it more clear, as i am still struggling.

Addon 1 is: _deranjata
Addon 2 is: Shadowed Unit Frames

i want Shadowed unit frames to wait for _deranjata to load before it trys to load
__________________
  Reply With Quote
05-03-22, 10:08 AM   #5
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
Originally Posted by Fizzlemizz View Post
Make addon 1 a dependancy of addon 2 in its .toc. Optional or Required depending on wether addon 1 may be installed or not.

## OptDeps: AddOn1
or
## RequiredDeps: AddOn1
i tried this and its still doing the baddie,

way to repeat issue so you may test if you wish.

DL and use just Project Deranjata,
DL and Use SUF.

after initial setup, on reload the SUF Bars Change position until you open its config and uncheck and recheck the lock frames section under General.

from all i have read it is because i am changing the CVar's with this code to attain perfect alignment within Project Deranjata

Lua Code:
  1. SetCVar("useuiScale", 1);
  2. SetCVar("displaySpellActivationOverlays", 0);
  3. SetCVar("uiScale", 0.60);
__________________
  Reply With Quote
05-03-22, 10:34 AM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Yeah, dependancies won't work if you're talking about making your addon a dependacy of someone elses.

Probably need to see if there some way to re-initialise SUF after you've done your changes.

If SUF uses Ace and assuming you are using your own profile to confiugure it then maybe something like:

Code:
-- Do your changes then:
local Shadowed = NS.AceAddons:GetAddon("Shadowed whatever", true)
Shadowed.db:SetProfile("Whatever your profile name is")
I don 't know Shadowed so .db tends to be the convention but may be solmething else.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
05-03-22, 12:07 PM   #7
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
With something like SUF, it's highly unlikely your problem is the addon load order but more likely the event and event processing order where SUF does it's actual profile/frame initialisation processing.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 05-03-22 at 12:10 PM.
  Reply With Quote
05-04-22, 05:50 AM   #8
Uitat
A Chromatic Dragonspawn
 
Uitat's Avatar
AddOn Author - Click to view addons
Join Date: May 2011
Posts: 162
may not be my best solution

yeah i think this may not be the solution i am looking other direction
__________________
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » addon loading order.

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off