View Single Post
04-05-12, 05:54 PM   #11
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Before asking for help/feedback on your code, your first step should always be to load it in-game, or at least run it through a Lua syntax checker, and attempting to fix the basic syntax errors. In this case, "if for ... end else ... end" is not valid Lua syntax.

If the TimerTrackerN bars have the same structure as the MirrorTimerN bars, then you can just add them to the existing list of bars the "for ... end" loop should iterate over (on line #3):

Lua Code:
  1. -- mirror castbar!
  2.   lib.gen_mirrorcb = function(f)
  3.     for _, bar in pairs({'MirrorTimer1','MirrorTimer2','MirrorTimer3','TimerTrackerTimer1','TimerTrackerTimer2','TimerTrackerTimer3'}) do  
  4.       for i, region in pairs({_G[bar]:GetRegions()}) do
  5.         if (region.GetTexture and region:GetTexture() == 'SolidTexture') then
  6.           region:Hide()
  7.         end
  8.       end
  9.       _G[bar..'Border']:Hide()
  10.       _G[bar]:SetParent(UIParent)
  11.       _G[bar]:SetScale(1)
  12.       _G[bar]:SetHeight(16)
  13.       _G[bar]:SetWidth(280)
  14.       _G[bar]:SetBackdropColor(.1,.1,.1)
  15.       _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar])
  16.       _G[bar..'Background']:SetTexture(cfg.statusbar_texture)
  17.       _G[bar..'Background']:SetAllPoints(bar)
  18.       _G[bar..'Background']:SetVertexColor(.15,.15,.15,.75)
  19.       _G[bar..'Text']:SetFont(cfg.font, 14, "THINOUTLINE")
  20.       _G[bar..'Text']:ClearAllPoints()
  21.       _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
  22.       _G[bar..'StatusBar']:SetAllPoints(_G[bar])
  23.       --glowing borders
  24.       local h = CreateFrame("Frame", nil, _G[bar])
  25.       h:SetFrameLevel(0)
  26.       h:SetPoint("TOPLEFT",-5,5)
  27.       h:SetPoint("BOTTOMRIGHT",5,-5)
  28.       lib.gen_backdrop(h)
  29.     end
  30.   end
  Reply With Quote