View Single Post
05/16/23, 09:56 AM   #9
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
It does not read anything from savedvariables, it's reading it via API functions from your account. No SV needed for that.

What do you want to save in the SV? All the characternames and ids? Not needed as they do not change and the function can determine them on the fly quickly.
Just call that ONCE at start of your addon and keep them local in your addon data, not in the sv.

e.g. MyAddon.characterData = GetCharactersOfAccount(false)
If you need the characterId or name then just access your MyAddon.characterData table.
Or build yourself a lookup tbale like described above with the choices and choicesValues example for the LAM dropdown!

Example for LAM dropdown "Choose a character":
Follow my example how to build the choices and choicesValues above, last post!

And then use the characterId returned by choicesValues, via the LAM dropdown -> selected entry will use the choicesValues characterId and pass it to the setFunc of your dropdown -> save the selected characterId to the SV that way via the setFunc as normal LAM settings work.


General character dependent SavedVariables (if your addon should save per char and not per account):
If you want to save data BELOW your characterId in the SavedVariables you need to use another ZO_SavedVars: wrapper like NewCharacterIdSettings instead of New or NewAccountWide, but this will save your total SavedVars character dependent and not account dependent then.

The WIKI explains more, search there please.


If this all does not help please explain what exactly you want to achieve here, and if you use a LAM dropdown and what it should show as entries, and what should happen then if you change that dropdown entries etc.
Make a simple example and describe in simple steps, and then we will find a simple way (or not ;-) ).

Last edited by Baertram : 05/16/23 at 10:03 AM.
  Reply With Quote