How to make GUI changes stay after /reloadui
I'm trying to make an addon that replaces the compass with a different graphic (more similar to the one in Nordic UI from Skyrim, which I think looks a lot better).
I have a problem that when I first launch the game and log in my compass graphic is there, but when I do /reloadui it defaults to either vanilla (if I have no other mods running), or DarkUI (if I have that addon running too). I'll include the code below, it's quite short: Code:
function SlimCompass() |
Addons all run thorught EVENT_ADD_ON_LOADED in a load order which is defined by the dependencies.
If Dark UI runs the same redirect at it's own EVENT_ADD_ON_LOADED callback it might revert yours which have been done before! So add DarkUi to your ## OptionalDepends: list in your manifest txt so it will load before your addon and then EVENT_ADD_ON_LOADED of your addon should fire after the one of DarkUi. For vanilla UI: It should always be called before addons so I don't know why it's not updatig the texture from your addon then properly. Maybe the compass got a function that calls the texture update after event_add_on_loaded. Try to use event_player_activated in your case instead of event_add_on_loaded (but only let it do that once! as it will call the same event on every zone change with loading screens too). Btw: Unregister your EVENT_ADD_ON_LOADED after your addon code was run! Else your callback function will be called for every other addon again and again allthough it does not need to do anything anymore... And please define functions not global! Add local inf ront else they pollute the global namespace in table _G and will overwrite other addons/vanilla variables and code! OR define the global functions with a unique name, not SlimCompass or similar. IF you need themt o be global add 1 global table with your addonName and then add functions to it. SlimCompass = {} function SlimCompass.ChangeCompass() end In your case a local function SlimCompass() should be enough, same for OnAddOnLoaded!!! See best practices etc here: https://www.esoui.com/forums/showthread.php?t=9867 Example code with EVENT_PLAYER_ACTIVATED (fires after EVENT_ADD_ON_LOADED, as player is ready in the ingame wordla dn chat is ready): Lua Code:
|
I've implemented your suggestions but sadly haven't seen a difference in how it behaves (shows on login, but disappears with a /reloadui).
I think I might not be adding the optional dependencies correctly in my manifest file. I haven't found a lot of information on if the addon name in the manifest dependency is supposed to be the name of that addon's subfolder in the ESO AddOn folder, of if it's meant to be the exact same name as is listed in their own manifest. I decided to do both, just in case: Code:
## OptionalDependsOn: DarkUI CleanerHUD Azurah |
The line 1 version should be correct. You could verify its correct by changing it to dependsOn and checking that the addon can't be selected without them.
|
The dependencies always need the "folder name" (or txt file name without the .txt) without any color coding like that |c or |r and without any spaces !!!
If the addon is live/AddOns/AddonName1 You need to add: ## OptionalDependsOn: AddonName1 If you want to add multiple you can add them in the same row up to a maximum length you can see at the Wiki: https://wiki.esoui.com/Addon_manifes...ionalDependsOn ## OptionalDependsOn: AddonName1 AddonName2 Also adding a version check is possible there via >=<versionOfTheOtherAddon> tag at the end. That's described here: https://wiki.esoui.com/Libraries#.23...ned_integer.3E If that Optional dependency does not fix it you need to check in the other addons "where they do the RedirectTexture" and then do your's later/after that. Maybe using a RedirectTexture for the same texture, in multiple addons, won't work as textures are cached in the file live/ShaderCache.cooked Once they got loaded you can only overwrite them visually ingame by logout, delete the file and then do the RedirectTexture again. Sometimes it's working by doing a RedirectTexture multiple times, sometimes it doesn't, which makes multiple addons changing the same texture not work in combination and thus you need to code the dependency manually in all addons then. Like check if Addon1 is active and it's setting to replace compass is active then do not change it in Addon2, and if Addon3 is active and setting to change the compass is active do not change it in Addon1 nor Addon2. Or similar logic. |
All times are GMT -6. The time now is 02:34 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI