View Single Post
01/25/16, 08:22 PM   #14
Terrillyn
AddOn Author - Click to view addons
Join Date: Jan 2016
Posts: 24
Well I spoke too soon, it wouldn't let me set accountwide settings when I did that, seems nothing I try lets me copy over another table, aside from writing a large function to manually copy over all the vars.
For now I'll just keep character and account settings in separate SavedVars, this means the user should enable the Account-Wide toggle before making any changes.

checkbox
Lua Code:
  1. setFunc = function(val)
  2.     if val then
  3.         SimpleXPBar.CurSV = SimpleXPBar.AWSV
  4.     else
  5.         SimpleXPBar.CurSV = SimpleXPBar.CharSV
  6.     end
  7.     SimpleXPBar.AWSV.general.account_wide = val
  8.     SimpleXPBar:UpdateStats()
  9.     SimpleXPBar:UpdateValues()
  10. end,

At playerload
Lua Code:
  1. SimpleXPBar.AWSV = ZO_SavedVars:New("SimpleXPBar_Settings", "1", nil, SimpleXPBar.default_settings, nil, nil, '$' .. SimpleXPBar.name)
  2. SimpleXPBar.CharSV = ZO_SavedVars:New("SimpleXPBar_Settings", "1", nil, SimpleXPBar.default_settings)
  3.  
  4. if SimpleXPBar.AWSV.general.account_wide then
  5.     SimpleXPBar.CurSV = SimpleXPBar.AWSV
  6. else
  7.     SimpleXPBar.CurSV = SimpleXPBar.CharSV
  8. end
  Reply With Quote