View Single Post
06/19/23, 09:42 AM   #1
sinnereso
AddOn Author - Click to view addons
Join Date: Oct 2022
Posts: 247
Question General saved variable questions

Hiya I have an addon with account wide saved variables but I'm looking to save 1 specific option as character specific.

Ive been trying different ways to format "the saving of" the variable to turn it into a sort of named table for each character that would save an ID number that would look something like this:
Code:
MyAddonVars =
{
    ["Default"] = 
    {
        ["@MyUsername"] = 
        {
            ["$AccountWide"] = 
            {
                ["savedVariable"] = something,--<<<< the normal account wide variables
                ["savedVariable"] = something,
                ["savedVariable"] = something,
                ["savedVariable"] = something,
                ["charVariables"] = character1 = 10,--<<< table for each char saving a skill ID i need
                                    character2 = 12,
                                    character3 = 14,
                                    character4 = 16,

I suppose the format below would be ok as well incase I wanted to save more to each character later..

{
    ["Default"] = 
    {
        ["@MyUsername"] = 
        {
            ["$AccountWide"] = 
            {
                ["savedVariable"] = something,--<<<< the normal account wide variables
                ["savedVariable"] = something,
                ["savedVariable"] = something,
                ["savedVariable"] = something,
                ["character1"] = skillId = 10,--<<< this style would also work
                ["character2"] = skillId = 12,
                ["character3"] = skillId = 14,
                ["character4"] = skillId = 16,
is there a way to format "the saving of" my variables to save & access that table that actually works? Currently using "Myaddon.savedVariables.XXXXXX to save the upper ones listed there. Like the equivalent of using something like:
Code:
Myaddon.savedVariables.[charVariables].GetUnitName("player") = 10
or
Myaddon.savedVariables.GetUnitName("player").skillId = 10
or even
Myaddon.savedVariables.GetUnitName("player") = 10
OR

is it possible to define 2 sets of variables in one file like account wide AND character name specific with these? Id prefer option 1 though if possible.
Code:
MyAddon.savedVariables = ZO_SavedVars:NewAccountWide( MyAddon.svName, MyAddon.svVersion, nil, defaultSavedVars )
I think I know its possible and how to create a second saved variable file that character specific but prefer that as a last option

Last edited by sinnereso : 06/19/23 at 11:00 AM.
  Reply With Quote