Quantcast WoWInterface - View Single Post - Strangeness with SavedVariables and SavedVariablePerCharacter
View Single Post
07-10-13, 05:45 AM   #5
Yup
A Murloc Raider
 
Yup's Avatar
Join Date: Jul 2013
Posts: 8
Well, I had modified it to check for ADDON_LOADED, and that's what I'm going to be doing with my own project. I just posted the original because it was directly from a tutorial that had always worked for me anyway. And no, even with checking for ADDON_LOADED it didn't work. It doesn't matter anyway, the update seems to have fixed things, though I don't know why.

Something analogous to what I modified it to:
Lua Code:
  1. local EventFrame = CreateFrame("Frame")
  2.  
  3. EventFrame:RegisterEvent("ADDON_LOADED")
  4. EventFrame:SetScript("OnEvent", function(self,event,name,...)
  5.     if name == "WhyHelloThar" then
  6.         if type(charVar) ~= "number" then
  7.             charVar = 1
  8.             ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  I do believe this is the first time we've met.  Nice to meet you!")
  9.         else
  10.             if charVar == 1 then
  11.                 ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  How nice to see you again!  I do believe I've seen you once before.")
  12.             else
  13.                 ChatFrame1:AddMessage('WhyHelloThar ' .. UnitName("Player") .. ".  How nice to see you again!  I do believe I've seen you " .. charVar .. " times before.")
  14.             end
  15.             charVar = charVar + 1
  16.         end
  17.     end
  18. end)
  Reply With Quote