View Single Post
03-16-12, 02:41 AM   #3
kaels
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jan 2011
Posts: 46
Basically, you have 2 problems with how you're referring to your saved variables. See here:
lua Code:
  1. function events:UNIT_POWER(source,type)
  2.     if source == "player" and type == "HOLY_POWER" then
  3.         local power = UnitPower("player",9)
  4.  
  5.         if power == 1 then
  6.             texture:SetTexture(self.db.textureSelect.."1.tga")
  7.             frame:Show()
  8.  
  9.         elseif power == 2 then
  10.             texture:SetTexture(self.db.textureSelect.."2.tga")
  11.             frame:Show()
  12.  
  13.         elseif power == 3 then
  14.             texture:SetTexture(self.db.textureSelect.."3.tga")
  15.             frame:Show()
  16.  
  17.         elseif power == 0 then
  18.             frame:Hide()
  19.         end
  20.     end
  21. end
"self" in this function refers to "events", so it's trying to access events.db instead of HolyPowerIndicator.db.

The other problem is that HolyPowerIndicator.db is defined here:
lua Code:
  1. self.db = LibStub("AceDB-3.0"):New("HolyPowerIndicatorDB", defaults, "Default")
to refer to the table "defaults", but the data you're actually interested in is in defaults.profile.

So basically you need to replace all instances of "self.db" (ouside of your OnInitialize function) with "HolyPowerIndicator.db.profile".
  Reply With Quote