I've been having an intermittent problem with my addon (SwapSpec) I just can't figure out, I've tried searching for someone else reporting the same problem but could not find any solutions.
Whats happening is my saved variables seem to be loosing their values every once in a while when I zone. The result is as if I set the values to nil. I've seen it happen between continents and going into or out of an instance. It doesn't happen every time or with any other addons than mine. If I had to put a number to it I would say it happens about 1% or 2% of the time.
The only time I've coded for the values to change are on the ADDON_LOADED event and when the user clicks OK on the options window (plugged into the blizzard options panel).
What am I missing here, what exactly happens during zoning that could sometimes but not always do this?
If you want to thumb through my code the addon name is SwapSpec
The ADDON_LOADED event is fired every time an addon is loaded. So, if a user is running AddonLoader, Grid, Quartz, SwapSpec, and TourGuide, the loading process will go something like this:
* Read AddonLoader TOC; it's not LoD, so...
* Read all AddonLoader files and saved variables.
ADDON_LOADED, arg1 = "AddonLoader"
* Read Grid TOC; it's not LoD, so...
* Read all Grid files and saved variables.
ADDON_LOADED, arg1 = "Grid"
* Read Quartz TOC; it is LoD, so skip it.
* Read SwapSpec TOC; it's not LoD, so...
* Read all SwapSpec files and saved variables. ADDON_LOADED, arg1 = "SwapSpec"
* Read TourGuide TOC; it's LoD, so skip it.
* All non-LoD addons and their saved variables have been loaded.
* Spell information is now available to the client.
* You are now logged in.
* All sizing and positioning of UI elements has been done.
* All player data, including talent information, is now available to the client.
* AddonLoader starts loading all addons that are set up for delayed loading.
* Quartz is set up for delayed loading, so load it.
ADDON_LOADED, arg1 = "Quartz"
* TourGuide is set up for delayed loading, so load it.
ADDON_LOADED, arg1 = "TourGuide"
Did you check for arg1 == "youraddon" in your ADDON_LOADED event function?
yes I did, as I mentioned in the edit earlier though the ADDON_LOADED event is not the problem here, it would set my hideSpam and showText variables to True, and only then if they were nil before. The problem I'm occasionally running into either sets the value of both of those to False or nil. I suspect the latter since the string variables are being set to either "" or nil.
There is actually more than this, one thing I know is in there are a couple PLAYER_TALENT_UPDATE events. To fix some exploit involving keeping primary talents after doing a well timed talent group change close to zoning, Blizzard sets all your talents (and I think your skills too) to all unlearned briefly during the zone process. This actually bit me with my addon and I had to disable a few things related to this event.