View Single Post
01/25/16, 04:52 AM   #2
coolmodi
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 47
What I see at the first glance is this

Lua Code:
  1. if SimpleXPBar.accountwide_settings.isAccountWide then
  2.     ZO_DeepTableCopy(SimpleXPBar.AWSV, SimpleXPBar.CharSV)
  3.     SimpleXPBar.CurSV = SimpleXPBar.AWSV
  4. else
  5.     SimpleXPBar.CurSV = SimpleXPBar.CharSV
  6. end

Doesn't that mean you use AWSV to save new changes but copy the data from CharSV (that didn't change) over that every time you reload UI? That would reset it to whatever is in CharSV. But maybe ZO_DeepTableCopy is the other way round, don't know.

Edit: Either way I think it has to be the ZO_DeepTableCopy function, my solution was pretty much the same, just without copying tables around (why would you do that anyways?).

Lua Code:
  1. function GroupDamage:RestoreData()
  2.     self.savedVariablesAw = ZO_SavedVars:NewAccountWide("GroupDamageSavedVariables", defaultVarsVer, nil, defaults)
  3.     self.savedVariablesChar = ZO_SavedVars:New("GroupDamageSavedVariables", defaultVarsVer, nil, defaults)
  4.     self.svars = self.savedVariablesChar
  5.     if self.savedVariablesAw.accountWide then
  6.         self.svars = self.savedVariablesAw
  7.     end
  8. end
  9.  
  10. --the AW checkbox
  11. {
  12.             type = "checkbox",
  13.             name = GetString(SI_GROUPDAMAGE_MENU_ACCWIDESETTINGS),
  14.             getFunc = function() return self.savedVariablesAw.accountWide end,
  15.             setFunc = function() self.savedVariablesAw.accountWide = not self.savedVariablesAw.accountWide ReloadUI() end,
  16.             warning = GetString(SI_GROUPDAMAGE_MENU_RELOADWARN)
  17.         },
  18.  
  19. --a colorpicker, you can use tables for the colors and then unpack(table) to make it alot shorter and easier to use ;)
  20. {
  21.             type = "colorpicker",
  22.             name = GetString(SI_GROUPDAMAGE_MENU_BARSCOLOR),
  23.             getFunc = function() return unpack(self.svars.panelBarsColor) end,
  24.             setFunc = function(r,g,b,a)
  25.                 self.svars.panelBarsColor = {r,g,b,a}
  26.                 self:ResetPanelControls()
  27.             end,
  28.         },

Last edited by coolmodi : 01/25/16 at 05:26 AM.
  Reply With Quote