07/18/23, 10:17 AM | #1 |
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 {} local characterId = GetCurrentCharacterId() ResourceRadar_SavedVars.character = ResourceRadar_SavedVars.character or {} ResourceRadar_SavedVars.character[characterId] = ResourceRadar_SavedVars.character[characterId] or {} self.currentProfile = ResourceRadar_SavedVars.character[characterId] self:InitializeDefaults() 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 = { ["character"] = { ["8796093035941557"] = { ["worldPinPulse"] = false, ["displayNodesInWorld"] = true, ["compassPinSize"] = 20, ["displayNodesOnMap"] = false, ["worldPinSize"] = 66, ["displayNodesOnCompass"] = false, ["removeOnDetection"] = { [1] = false, [2] = false, [3] = false, [4] = false, [5] = false, [6] = false, [7] = false, [8] = false, [9] = false, [100] = false, }, ["mapPinSize"] = 16, ["worldPinTexture"] = "esoui/art/ava/ava_rankicon64_centurion.dds", ["pinTextures"] = { [1] = "esoui/art/crafting/smithing_tabicon_refine_down.dds", [2] = "esoui/art/icons/servicemappins/servicepin_clothier.dds", [3] = "esoui/art/icons/mapkey/mapkey_lumbermill.dds", [4] = "esoui/art/crafting/enchantment_tabicon_essence_down.dds", [5] = "esoui/art/crafting/alchemy_tabicon_reagent_down.dds", [6] = "esoui/art/icons/servicemappins/servicepin_dyestation.dds", [7] = "ResourceRadar/Textures/waterplant.dds", [8] = "esoui/art/treeicons/store_indexicon_consumables_down.dds", [9] = "esoui/art/icons/servicemappins/servicepin_alchemy.dds", [100] = "esoui/art/icons/poi/poi_crafting_complete.dds", }, ["pinColors"] = { [1] = { [4] = 1, [1] = 0.4470000000, [2] = 0.4900000000, [3] = 1, }, [2] = { [4] = 1, [1] = 0.5880000000, [2] = 0.9880000000, [3] = 1, }, [3] = { [4] = 1, [1] = 1, [2] = 0.6940000000, [3] = 0.4940000000, }, [4] = { [4] = 1, [1] = 1, [2] = 0.4550000000, [3] = 0.4780000000, }, [5] = { [4] = 1, [1] = 0.4510000000, [2] = 0.5690000000, [3] = 0.4240000000, }, [6] = { [4] = 1, [1] = 0.5570000000, [2] = 1, [3] = 0.5410000000, }, [7] = { [4] = 1, [1] = 0.4390000000, [2] = 0.9370000000, [3] = 0.8080000000, }, [8] = { [4] = 1, [1] = 0.5690000000, [2] = 0.8270000000, [3] = 1, }, [9] = { [4] = 1, [1] = 0.9340000000, [2] = 0.3450000000, [3] = 0.5370000000, }, [100] = { [4] = 1, [1] = 1, [2] = 0.0117647061, [3] = 0, }, }, }, }, } 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. Last edited by NeuroticPixels : 07/18/23 at 10:21 AM. |
|
07/18/23, 10:34 AM | #2 |
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. Last edited by Baertram : 07/18/23 at 10:41 AM. |
|
07/18/23, 12:12 PM | #3 |
Thank yoooou! You are a king, good sir!
|
|
ESOUI » AddOns » AddOn Help/Support » Change to account-wide settings? (ResourceRadar) |
«
Previous Thread
|
Next Thread
»
|
Display Modes |
Linear Mode |
Switch to Hybrid Mode |
Switch to Threaded Mode |
|
|