ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Detecting Character Deletion / Rename / Replace (https://www.esoui.com/forums/showthread.php?t=5163)

zgwortz 09/15/15 01:04 PM

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.

Baertram 09/15/15 01:14 PM

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.

merlight 09/15/15 01:42 PM

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.

circonian 09/15/15 01:52 PM

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).

zgwortz 09/15/15 04:20 PM

@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).


All times are GMT -6. The time now is 04:41 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI