Windower / Lua

Lua Addons and Scripts
242 stars 429 forks source link

Config Library: Player settings getting reverted, replicated #1447

Open flippant opened 8 years ago

flippant commented 8 years ago

1. Player settings getting reverted If I attempt to change some of the individual player settings in a addon (one that saves the settings file after it's loaded), then reload it on a different character, some of the settings will revert back to what they were before.

Unloading the addon, logging everyone out, or starting with a fresh auto-created settings file does not help. In the case of the latter, once I add the character's tags in again, all of the old settings will suddenly reappear.

A specific example: I am logged onto Character1 and Character2. I go into the Scoreboard settings.xml and delete the <visible>true</visible> tag (or set to false) under Character1's settings. No matter how many times I reload on Character1, the tag remains gone. However, once it's reloaded on Character2, Character1's <visible>true</visible> will come back.

I tried adding new options under Character1 (<showfellow>false</showfellow> and <numplayers>7</numplayers>), but I had no issue immediately removing/changing their values. However, a few minutes later, the same thing started to happen. If I delete/change them, they will revert once I reload Scoreboard on Character2.

2. Player settings getting replicated If I add any options to a character's tag in Scoreboard, the new option will get replicated to every other character's tag, even ones that are created at a later time.

ryanskeldon commented 8 years ago

You're logged into both Character1 and Character2? They're going to conflict with each other since the settings.xml file isn't unique (to my knowledge) to a character. Until the add-on is updated to support multiple characters, you're going to continue to have this issue.

The source for Scoreboard doesn't show any logic for handling multiple character settings.

jerryhebert commented 8 years ago

scoreboard uses the config lib which supports multi-character settings

ryanskeldon commented 8 years ago

Forgive me. I should have RTFM for the config lib.

z16 commented 8 years ago

Debugging this would require quite a bit of effort, since it would require familiarizing myself with how Scoreboard handles the config lib. Could you maybe create a simple test addon that showcases the problem? I do not have the time to dig through Scoreboard and work off of your description, so it would help a lot if you could provide a simpler test case.

flippant commented 8 years ago

I could not recreate the issue until I changed the global settings. It seems like rather than cascading the global settings, the default settings get pushed to the individual characters if the setting isn't already there explicitly.

Using the attached addon:

  1. I logged into two characters, loaded it on both
  2. Went to settings, changed global debug to true, added a new tag for Character1, and put <debug>false</debug> for that character.
  3. Reloaded addon on each character. Everything is fine.
  4. Added new tag for Character2, and added <autoexport_interval>10</autoexport_interval> to both characters (to keep tag from disappearing whenever you remove the debug later).
  5. Reloaded addon on each character. Character2 now has <debug>false</debug>.
  6. Removed the debug from Character1 and reloaded addon on both. Debug reappears under Character1 when Character2 reloads.
  7. Same as step 6, but reversed the characters.
  8. Changed the global update_interval to "30" and reloaded on both characters. When each character was reloaded, <update_interval>3</update_interval> (the default) appeared under the opposite character.
  9. Again, deleting it and reloading on the opposite character will continue to bring that setting back. Changing it to 30 and reloading once will remove it altogether because it is the same as default, and reloading a second time will bring the 3 back. cftest.zip

Since settings will get removed from the individual tags if their values are identical to the global settings, I'd have to revert the global settings back to their defaults, and make the settings for each and every character.