View Single Post
07/09/16, 01:23 AM   #17
votan
 
votan's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 577
Originally Posted by sirinsidiator View Post
From the two ways that you have brought up, I would prefer the unique identifier.

I don't think just giving us the previous name is enough. What will happen when a user renames the character, loads the game, quits the client via alt+f4 and loads the game again? Or when he disables an addon, renames, loads, renames again and then enables the addon?

Giving us the unique identifier is a good way to make sure that we have the right character, regardless of how often it is renamed, but using it as the key in the save data may be inconvenient for users that want to edit the save data from hand and putting the character name in the table is not really ideal as it could break an addon that doesn't expect the new entry in the table. Maybe you could extend the save data serialization so it can put comments into the file and add the character name there? That way it could be in the same line as the table key and would not interfere with existing addons. I am not sure how the API for that would look though.
Maybe have a method to read and write comments for a key in a table? GetSaveDataComment(table, key), SetSaveDataComment(table, key, comment)?
The case where a player disables an addon before the conversion to the new identifier, then renames and afterwards reactivates the addon would still remove the save data, but I think it could be neglected.

I still believe having the account history would be a better way of solving this problem, but identifiers are also nice. Maybe we could also get them for another player's characters? Some addons save things about other chars and would not be able to follow renames, which would result in a loss of data.
I obviously missed the point of what to choose between....

/sign: Of course ID. I like the idea of comment as a hint.
And maintain a ID-to-Details table in ZO_Ingame:
Code:
["$Characters"] = {
   [ID] = {
      name = "abc",
      lastName = "xyz",
      lastClass = 1,
      lastGender = 2,
      history = { -- reserve for next release?
      }
      ...
   },
   [ID2] = {
   ...
   }
}
ZO_Ingame is the well-known variable you can save data in while pre-game.