Strangeness with SavedVariables and SavedVariablePerCharacter
I seem to be having a problem where I can't access any saved variables from my own AddOns. It works with others, like Recount, but when I try to access and save my own, it seems to just ignore SavedVariables and SavedVariablesPerCharacter.
And example would be the simple WhyHelloThar tutorial AddOn from this MMO-Champion thread, using the code from the Alternate Method:
WhyHelloThar.toc
Code:
## Interface: 50300
## Title: WhyHelloThar
## Author: SomeoneElse
## Dependencies: Ace3
## OptDeps: BugSack, !Swatter
## SavedVariables: mySavedVar
## SavedVariablesPerCharacter: charVar
WhyHelloThar.lua
WhyHelloThar.lua
Lua Code:
local EventFrame = CreateFrame("Frame") EventFrame:RegisterEvent("PLAYER_LOGIN") EventFrame:SetScript("OnEvent", function(self,event,...) if type(charVar) ~= "number" then charVar = 1 ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ". I do believe this is the first time we've met. Nice to meet you!") else if charVar == 1 then ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ". How nice to see you again! I do believe I've seen you once before.") else ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ". How nice to see you again! I do believe I've seen you " .. charVar .. " times before.") end charVar = charVar + 1 end end)
It was working for a while then it just gave out. It works during the session, starting over again at an empty variable, but will not save over sessions or load from previous ones. I'm extremely new to AddOn development so any advice would be appreciated. :)
|