Change to account-wide settings? (ResourceRadar)
Hi.
I looked through https://www.esoui.com/forums/showthread.php?p=41611 to see if I could figure out how to edit a lua to make it use account-wide settings. I couldn't figure it out. I tried and failed. Received an error upon logging in to ESO. I have this saved as a reminder: But..... I've never seen an addon use this before: Code:
ResourceRadar_SavedVars = ResourceRadar_SavedVars or {} I tried looking at the Saved Variables to see if I could edit those. But it seems to be missing the line for my character name, so I don't know how to add that. I don't know if everything has to be indented properly.... I don't know where exactly to put brackets... ugh. This is what the saved variables currently say: Code:
ResourceRadar_SavedVars = I figured I needed to put in the account name between those. (["@NeuroticPixels"]). But I don't know about all the indents for each line and how to connect the brackets. :( I've only ever edited what's in a saved vars. I've never had to add any new lines. I apologize for my ignorance. Please be gentle with me. |
Seems the addon is not using the ZO_SavedVars wrapper for accessing the SV table ResourceRadar_SavedVars.
-> The wrapper is creating the subtables ["default'] and [$AccountWide] e.g. so they are missing because ZO_SavedVars was not used! Exaplanation: SavedVars defined as ## SavedVariables in the addon's txt file are just a global table. So ResourceRadar_SavedVars is a table. And the addon decided to add the structures like the characterId etc. "manually" to that table instead of using the Zos wrapper for that, called "ZO_SavedVars". If you want to change the addon's SV table from characterId to accountWide you need to replace each occurence of characterId in there with your accountName (API function: GetDisplayName()) This applies to the code you had copied here, but also to the settings menu and every other file and code where ResourceRadar_SavedVars is currently used with the .character[characterId]. I'd keep the .character subtable in the SV table ResourceRadar_SavedVars, and just add a new subtable .account. That way you could switch back to characterId SV later. See further down below! Code now: Lua Code:
Could be changed to: Lua Code:
And after that you need to find EACH code line where currently ResourceRadar_SavedVars.character[characterIdHere] is used and replace it with ResourceRadar_SavedVars.account[GetDisplayName()] so that the SV table will be read from your account data now. After 1st login and 1x /reloadui ingame., with that changed SV data subtable .account, you should see the .account table in the SV file in your live/SavedVariables/<addonFolderName>.lua file. And you can logout then, backup the file and manually copy over your character entry of 1 of your characters to the account["@YourAccountNameHere"] table. If you have kept the .character subtables: You could even add a settings menu entry to switch that dynamically via the LibAddonMenu settings. Like always read the account SV first and if there is saved something like a boolean (true/false) variable savePerCharacter you can switch the SV usage with it. -> Checkbox in LAM settings of the addon should change ResourceRadar_SavedVars.account[currentAccount].savePerCharacter via it's setFunc and read the same via the getFunc. At the SV initialization you can read it explicitly then and switch the SV usage: Lua Code:
You'd have to change the hardcoded usage of ResourceRadar_SavedVars.account or ResourceRadar_SavedVars.character to use the "sv" variable then, as it will "reference" then either the character or the account SV subtable for your saved data, for reading and writing. |
Thank yoooou! You are a king, good sir!
|
All times are GMT -6. The time now is 02:13 AM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI