Poster: Tandris at 8/21/2005 9:46:44 PM PDT Subject: Possible 1.7 Bug? |
| |
Alright, in 1.7 (on the test server currently), I know that SavedVariables are now Addon-Specific. However, here is the problem I am getting:
in the toc file I have
## SavedVariables: xx
then in the addon I have:
function xx_OnEvent()
if (event == "VARIABLES_LOADED") then
if (not xx) then
xx = { };
end
xx.version = "1.2";
User = UnitName("player").. " - " ..GetCVar("realmName");
if (not xx[User]) then
xx[User] = { };
end
if (not xx[User].var1) then
xx[User].var1 = 1;
end
end
end
Now, with this:RegisterEvent("VARIABLES_LOADED") being done in the on-load of this mod. This should save the tables: xx, xx[User], and the settings: xx.version, & xx[User].var1 to the SavedVariables.lua file with this addon name. However, after reloading the ui, the file is blank. After relogging, and restarting wow, the file is blank. Even if I do this manually ingame, the file is blank. Any idea's why?[ post edited by Tandris ]
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=202869&p=#post202869 |
| |
Poster: slouken at 8/22/2005 9:24:05 AM PDT Subject: Re: Possible 1.7 Bug? |
| |
To muddy the waters further, you shouldn't even need to use ADDON_LOADED instead of VARIABLES_LOADED.
Can someone put together a minimal addon that reproduces this problem?
Thanks!
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=202869&p=#post203001 |
Poster: slouken at 8/22/2005 9:25:43 AM PDT Subject: Re: Possible 1.7 Bug? |
| |
Our of curiousity, are you using both the ## line in the .toc and also RegisterForSave()? That might have unpredictable results...
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=202869&p=#post203002 |
Poster: slouken at 8/22/2005 12:56:02 PM PDT Subject: Re: Possible 1.7 Bug? |
| |
No, they're loaded afterwards.
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=202869&p=#post203107 |
Poster: slouken at 8/22/2005 3:58:34 PM PDT Subject: Re: Possible 1.7 Bug? |
| |
What's actually happening here is that the variables are being saved after the frames are destroyed, and when a frame is unregistered from the scripting system, it's registered name is cleared as well.
However, this is better behavior than if it did save your frame and tried to reload it... remember that the saved variables files are just script files that are executed at load, so when it runs the commands that restore a table, it overwrites that variable name with the new table... essentially losing the original frame.
So, yes, it's a bug, but don't do that, because it'll hurt. :)
|
| | http://forums.worldofwarcraft.com/thread.aspx?fn=wow-interface-customization&t=202869&p=#post203216 |