Thread Tools Display Modes
01-31-10, 11:11 AM   #1
prodigy
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 3
SavedVariables - help!

Currently, my addon is set up so that if the addon has never been loaded, it will automatically load a set of defaults based on the player's class.

The problem is that, from that point, if I log on another character that hasn't loaded the addon, it automatically loads the saved variables from the last character instead of loading the new character's defaults...

So lets say in my TOC file I have
## SavedVariablesPerCharacter: MyAddonPerCharacter
## SavedVariables: MyAddon

I have tried adding the following to the ADDON_LOADED event:
if MyAddonPerCharacter == nil then
--stuff goes here that loads the player's class defaults
end
but it didn't work...

any ideas??
  Reply With Quote
01-31-10, 11:16 AM   #2
Akryn
A Firelord
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 479
Why do you need to store per-character settings in the per-account variable, even though you've already set up a per-character variable?
  Reply With Quote
01-31-10, 11:28 AM   #3
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
Just use this:

Code:
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function()
	if not MyAddonPerCharacter then
		-- do something
	end
end)
f:RegisterEvent("PLAYER_ENTERING_WORLD")
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.
  Reply With Quote
01-31-10, 05:15 PM   #4
prodigy
A Defias Bandit
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 3
Figured it out... Thanks!
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » SavedVariables - help!


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