Thread Tools Display Modes
06/25/14, 04:55 AM   #1
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Saved vars and API version (or: I might have screwed up)

There has been some trouble with the saved vars beign reset (due do changes how they are saved/accessed). And suddenly I reliased:
Damn, that is good so. Becuase my addon (UTC) might break/damage the chat if it is apllying 100003 version settings for version 100007 chat (I am not sure it actually will. Would need the patchnotes and tests for that).

My Addon stores and applies data on wich ChatTab has wich Chatcategory enabeled (is listening to those channels). Categories are identified by a int. It also synchs Category Colors.
So naturally when gathering the data I go over all categories from 1 too GetNumChatCategories().
When applying it I go over all the int's from 1 to #StoredCategories.

This works if the number of chat categories stayed the same or increases and new were appended at the end.
This fails horribly if they changed the order of Chat Categories and/or added new ones in the middle. It is like Race Condition 101 all over.
I just need to figure out how to get the API version and use default data in the OnLoaded if the version differs.

I just thought I mention that because you might run into similar issues if you itterate over anything and write it back to the UI.

Last edited by zgrssd : 06/25/14 at 05:14 AM.
  Reply With Quote
06/25/14, 08:48 AM   #2
farangkao
 
farangkao's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 59
I have a similar thing with my Addon ,it saved the Item Links ,however since they changed in this Patch, the old Data needs to be cleaned

If you want to make sure, you just need to increase the Version number in your SavedVars call, then it will automatically discard the old data.
  Reply With Quote
06/25/14, 01:42 PM   #3
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by farangkao View Post
I have a similar thing with my Addon ,it saved the Item Links ,however since they changed in this Patch, the old Data needs to be cleaned

If you want to make sure, you just need to increase the Version number in your SavedVars call, then it will automatically discard the old data.
I mean "autoamtically" as in:
Code:
IF SAVED_VAR.Version ~= Current.API_VERSION then ...
Having to manually do that will result in not properly getting all cases. I did it via "disable addon in code, the make update with increasesd settings version" for this time.
But I want to directly couple that to the API version. As long as the data is gathered from the proper API version, wich version of the Addon has gathered it does not mater for now. It's a possible conflict between data from different API versions, not a conflict between data from different versions of the Addon.
For that I need some way to get the API version from the client, of course...
  Reply With Quote
06/25/14, 03:57 PM   #4
Sasky
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 231
For a workaround at least, you could try detection of some of the added/deleted global functions or variables.
Not perfect of course, as there's no way to know future versions before they're on PTS.
  Reply With Quote
06/25/14, 04:46 PM   #5
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Sasky View Post
For a workaround at least, you could try detection of some of the added/deleted global functions or variables.
Not perfect of course, as there's no way to know future versions before they're on PTS.
The only thing I found was among the global variables:
["_VERSION"] = 2013.1.0 r13331
Resetting after every client patch might be a bit overagressive. But I might have no other choice. Unless of course they alreay added/add a "GetAPIVersion()" function. I actually wrote something on the Wishlist for that:
http://www.esoui.com/forums/showthread.php?p=9751

But then again those Global Variables have not been udpate for a while and we are still waiting for the patchnotes. Maybe they added something for that already?
  Reply With Quote
06/27/14, 01:55 PM   #6
Kentarii
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
I store data in SV for my Quest Journal which isn't something I want to discard.. ZO really f..ked up this time.

I can fix it for my own use, but how can I expect the people using my addon to be able to fix it themselves?
  Reply With Quote
06/27/14, 02:50 PM   #7
zgrssd
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 280
Originally Posted by Kentarii View Post
I store data in SV for my Quest Journal which isn't something I want to discard.. ZO really f..ked up this time.

I can fix it for my own use, but how can I expect the people using my addon to be able to fix it themselves?
This is not about Zenimax mistake. That one will be fixed, just not sure when. And it just belongs to the normal issues of a major update. Next content update we will have to remind people of this, when they say "worst update ever".

This thread was about my mistake in addon design.
It was a mistake not to guard against API changes. My addons stored chat data should be reset (once) when the API has changed. That is the only saveguard against "changing order of categories" I have and entirely my responsibility.
And unlike most addons, the bulk of stuff it writes too is not even player setable (without other addons).
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Saved vars and API version (or: I might have screwed up)


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