View Single Post
08/30/18, 09:06 AM   #1
lnfinity
AddOn Author - Click to view addons
Join Date: Feb 2017
Posts: 22
How to make my addon load earlier?

So I recently made my own little addon which is supposed to execute a simple single command.
My intention to make this addon was that I wanted to play the game with spoken language in german and written language in english. This is doable by starting the game in german and then executing a certain command.
I decided to put that command into an addon file so that it automatically does the above whenever I start the game.
In theory it should work but I have a feeling that the addon executes too late, this ends up in having half of all texts still in german.
An additional /reloadui fixes the problem however.

Is there a possibility to make the command execute earlier (if I am even correct with my assumption)?

My code looks like this:
Code:
AdvancedLanguageSelector = {}
AdvancedLanguageSelector.name = "AdvancedLanguageSelector"
 
function AdvancedLanguageSelector:Initialize()
	SetCVar("language.2","en")
end
 
function AdvancedLanguageSelector.OnAddOnLoaded(event, addonName)
  if addonName == AdvancedLanguageSelector.name then
    AdvancedLanguageSelector:Initialize()
  end
end

EVENT_MANAGER:RegisterForEvent(AdvancedLanguageSelector.name, EVENT_ADD_ON_LOADED, AdvancedLanguageSelector.OnAddOnLoaded)
  Reply With Quote