Thread Tools Display Modes
09/15/15, 01:04 PM   #1
zgwortz
Join Date: Jun 2015
Posts: 23
Detecting Character Deletion / Rename / Replace

Okay, here's one I haven't seen addressed, and I haven't found anything in the API to deal with this, nor have I found any Addons which seem to address this...

Given you have an add-on which is collecting data about multiple characters (traits known, recipes known, etc.) for cross-character comparisons -- almost everyone is saving that data in account wide saved variables indexed by the character name as obtained by GetUnitName("player").

Except, it occurs to me, if you delete a character, and/or create a new character in the same slot, or if you rename a character (currently not possible, but quite likely down the road), everyone will end up with a kind of ghost of the older character in the saved variables, which can affect tooltips and all kinds of things.

Now, it seems unlikely that we can positively identify a deleted character, but is there any way to get the Character *slot* number of the current character being played? That would at least allow us to catch reused slots, or renamed characters.
  Reply With Quote
09/15/15, 01:14 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,989
Renaming a character is already in the game, but only if a gamemaster allows you to do it (due to special characters in your char name e.g.).

I didn't find any way to detect this so far. You could only save the settings accountwide and save each characters own settings in a special section of the account wide settings (like an increasing number).

There are addons that might help with deleting old, unneeded variables: ZGOO does the trick somehow if I remember right.
But I can't think of any other possibility to detect the character slot so far.
  Reply With Quote
09/15/15, 01:42 PM   #3
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
I have an add-on in mind that would hook ZO_SavedVars, add last login timestamp to character tables, and offer a menu to delete old ones (i.e. sort by timestamp and everything past 8 most recent logins are deleted characters). No code yet.
  Reply With Quote
09/15/15, 01:52 PM   #4
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
As far as I know neither is possible. The slots most likely reindex (change slot #'s) when a character is deleted anyhow which would mess everything up.

You could add a slash command that accepts a character name which wipes them from the saved data table for deleted characters. That's what I did. Or you could even make it a setting in the settings menu with a drop down box populated with current character names and a button to delete character data.

As for renamed characters I don't think it matters.
No matter how you keep track of "newly" researched traits or recipes, your addon must scan for all known recipes/traits when a new character logs in for the first time. Although "new level 1" characters won't know traits, someone installing your addon for the first time will be new to your addon & it needs to learn their traits. So either way when they rename their toon your addon will think they are a new character & it will rescan everything & fix itself (for the new character name).

Last edited by circonian : 09/15/15 at 01:55 PM.
  Reply With Quote
09/15/15, 04:20 PM   #5
zgwortz
Join Date: Jun 2015
Posts: 23
@circonian: I like the idea of a settings menu drop down box for deleting a character's saved data. I'll probably go that way lacking any other automated approach.

@merlight: That idea is a great one if we can guarantee they never went over 8 character slots… but I strongly suspect they'll allow more character slots at some point (probably through the crown store).
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Detecting Character Deletion / Rename / Replace


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off