So i'm developing my addon Autobanker and i was thinking that it would be nice to have a
dropdown menu where i can select each character and change their settings without having to log in to each character and set them through the settings menu.
My problem, or dilemma i should say is that i want to be able to do something like
Code:
local function OnDropDownSelect(choice)
UseSavedVarsFromCharacter(choice)
-- Now any changes to AB.savedVars will alter the data for the selected character
end
local function DoSomethingToCharacterSavedVars(data)
AB.savedVars.sometable = data
-- Changed something in another characters settings.
end
local function SaveCharacterSavedVars()
--???????
--???????
--???????
end
local function UseSavedVarsFromCharacter(characterId)
AB.savedVars = AB.savedVars["Default"][GetDisplayName()][characterId]
end
local function Initialize(event, addon)
-- Stripped non important parts here
AB.savedVars = ZO_SavedVars:NewCharacterIdSettings("AutobankerSavedVars", 4, nil, defaults)
end
My initial thought was that maybe i could call ZO_SavedVars:NewCharacterIdSettings but i realised that it uses GetCurrentCharacterId() to do the actual book-keeping and saving to disk. So i have no idea how i can save the AB.savedVars back to disk for the other character's settings i changed.
Would it work to use a accountwide savedVars and change the different characters settings in that table?