Can I access SavedVariables of other addon
Hi, I would like to do an extension for someone else's addon and for that I would need to acces it's SavedVariables without modifying that addon. Is this possible? Thanks.
|
Quote:
The saved variables are global, so yes you can, but: 1. You have to wait until the other addons are loaded. One way to do this is to make your addon ## OptionalDependsOn: in the manifest.txt. 2. Reading is ok, but for changing properties, you have check what the code does, which normally change them. |
Quote:
This is my almost first attempt at creating addon for eso and since the documentation is pretty lacking I'm not sure why it isn't working. |
Quote:
Basically, due to DependsOn, the AddonLoaded callback is called for the other addon first. So once the addonName is the name of the other addon, you can use the SavedVar as if it would be yours. You just have to use the same ZO_SavedVars method as the other addon, just without any defaults. |
Quote:
And for the rewriting of savedVariables, can I just use that reference (I assume that it's just a reference) to write to their savedVariables? |
You maybe could use the global savedvars of the other addon. But you need to check if they are using acocunt wide or character saved avrs, using the charname as key (ZO_SavedVars:New) or the new method with the charId (ZO_SavedVars:NewCharacterId) which is rename save.
And messing around with other addon's savedvars won't work properly if the other addon changes them back upon reloadui somehow from it's internal savedvars. The addon loads the savedvars into lest's say local settings 0 ZO_SavedVars:new(...). You change the global vars now from your addon in this addon's savedvars. Reloadui -> The adodnw rites it's local settings to the savedvars and overwrites your changed settings int he global SV again. |
Quote:
|
Please avoid if you didn't contacted the author, especially if you change the sv.
Lua Code:
after it's either ["Defaults$"] or charname or the char id depending on how the addon save the data. |
I agree with Ayantir. Just because it's possible doesn't mean it is a good idea.
Changing the save data of another addon can cause issues for both addons. When the original addon changes and something breaks due to you changing their data, either the author of it will get reports for some bug that has nothing to do with his addon or you will get reports because your addon won't work anymore. |
Maybe contact the author so he provides a global function in his addon which you can use to update the data properly in both addons.
|
All times are GMT -6. The time now is 09:05 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI