Quantcast WoWInterface - View Single Post - Strangeness with SavedVariables and SavedVariablePerCharacter
View Single Post
07-09-13, 04:54 PM   #1
Yup
A Murloc Raider
 
Yup's Avatar
Join Date: Jul 2013
Posts: 8
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:
  1. local EventFrame = CreateFrame("Frame")
  2.  
  3. EventFrame:RegisterEvent("PLAYER_LOGIN")
  4. EventFrame:SetScript("OnEvent", function(self,event,...)
  5.     if type(charVar) ~= "number" then
  6.         charVar = 1
  7.         ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  I do believe this is the first time we've met.  Nice to meet you!")
  8.     else
  9.         if charVar == 1 then
  10.             ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  How nice to see you again!  I do believe I've seen you once before.")
  11.         else
  12.             ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  How nice to see you again!  I do believe I've seen you " .. charVar .. " times before.")
  13.         end
  14.         charVar = charVar + 1
  15.     end
  16. 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.

Last edited by Yup : 07-09-13 at 04:55 PM. Reason: Added Information
  Reply With Quote