View Single Post
11/30/18, 04:34 AM   #1
r4cken
 
r4cken's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2018
Posts: 13
In need of help with loading my other characters savedVars and saving them

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?
  Reply With Quote