Thread Tools Display Modes
Prev Previous Post   Next Post Next
04-19-11, 06:34 PM   #1
Rainrider
A Firelord
AddOn Author - Click to view addons
Join Date: Nov 2008
Posts: 454
Problem with secure frame attributes

Hello,

I'm trying to bind a spell to middle click depending on player class from within the Factory function. Somehow it doesn't work. Here the code snippets:

lua Code:
  1. oUF:Factory(function(self)
  2.  
  3.     local playerClass = cfg.playerClass
  4.     local spellName
  5.    
  6.     if playerClass == "HUNTER" then
  7.          spellName = GetSpellInfo(34477)    -- Misdirection
  8.     elseif playerClass == "DRUID" then
  9.         spellName = GetSpellInfo(29166)     -- Innervate
  10.     elseif playerClass == "PALADIN" then
  11.         spellName = GetSpellInfo(31789)     -- Righteous Defense
  12.     elseif playerClass == "WARRIOR" then
  13.         spellName = GetSpellInfo(3411)      -- Intervene
  14.     elseif playerClass == "ROGUE" then
  15.         spellName = GetSpellInfo(57934)     -- Tricks of the Trade
  16.     elseif not spellName then
  17.         spellName = "Misdirection"
  18.     end
  19.  
  20.     self:SetActiveStyle("Rain")
  21.     self:Spawn("player", "oUF_Rain_Player"):SetPoint("CENTER", -210, -215)
  22.     self:Spawn("pet", "oUF_Rain_Pet"):SetPoint("BOTTOMLEFT", oUF_Rain_Player, "TOPLEFT", 0, 10)
  23.     self:Spawn("focus", "oUF_Rain_Focus"):SetPoint("BOTTOMRIGHT", oUF_Rain_Player, "TOPRIGHT", 0, 10)
  24.     self:Spawn("target", "oUF_Rain_Target"):SetPoint("CENTER", 210, -215)
  25.     self:Spawn("targettarget", "oUF_Rain_TargetTarget"):SetPoint("BOTTOMRIGHT", oUF_Rain_Target, "TOPRIGHT", 0, 10)
  26.     self:Spawn("focustarget", "oUF_Rain_FocusTarget"):SetPoint("BOTTOMLEFT", oUF_Rain_Target, "TOPLEFT", 0 , 10)
  27.    
  28.     if (cfg.showParty) then
  29.         local party = self:SpawnHeader(
  30.             "oUF_Rain_Party", nil, "solo,party,raid",
  31.             "showParty", true,
  32.             "showRaid", true,
  33.             "showPlayer", true,
  34.             "showSolo", true,
  35.             "maxColumns", 4,
  36.             "unitsPerColumn", 1,
  37.             "columnAnchorPoint", "LEFT",
  38.             "columnSpacing", 7.5,
  39.             "oUF-initialConfigFunction", ([[
  40.                 self:SetWidth(110)
  41.                 self:SetHeight(22)
  42.                 self:SetAttribute("type3", "spell")
  43.                 self:SetAttribute("spell3", %s)
  44.             ]]):format(spellName)
  45.         )
  46.         party:SetPoint("LEFT", UIParent, "BOTTOM", -231.25, 150)
  47.         party:Show()
  48.     end
  49. ...

I tested this on a druid, expecting to get Innervate or Misdirection if spellName and playerClass are not available. Instead I got nil. If I use self:SetAttribute("spell3", "Innervate") it works as expected. Is there an explanation for this? (Hopefully I typed it right )

I could also set the secure attributes from within the Shared function. Do I loose or gain something when doing so?

Thank you for your help
Rain
  Reply With Quote
 

WoWInterface » Featured Projects » oUF (Otravi Unit Frames) » Problem with secure frame attributes


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