Originally Posted by Phanx
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.
|
I understand. It was more of a half-ass pseudo code then anything else and I wasn't able to actually test anything in game until about 30 minutes ago.
Originally Posted by Phanx
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:
-- mirror castbar! lib.gen_mirrorcb = function(f) for _, bar in pairs({'MirrorTimer1','MirrorTimer2','MirrorTimer3','TimerTrackerTimer1','TimerTrackerTimer2','TimerTrackerTimer3'}) do for i, region in pairs({_G[bar]:GetRegions()}) do if (region.GetTexture and region:GetTexture() == 'SolidTexture') then region:Hide() end end _G[bar..'Border']:Hide() _G[bar]:SetParent(UIParent) _G[bar]:SetScale(1) _G[bar]:SetHeight(16) _G[bar]:SetWidth(280) _G[bar]:SetBackdropColor(.1,.1,.1) _G[bar..'Background'] = _G[bar]:CreateTexture(bar..'Background', 'BACKGROUND', _G[bar]) _G[bar..'Background']:SetTexture(cfg.statusbar_texture) _G[bar..'Background']:SetAllPoints(bar) _G[bar..'Background']:SetVertexColor(.15,.15,.15,.75) _G[bar..'Text']:SetFont(cfg.font, 14, "THINOUTLINE") _G[bar..'Text']:ClearAllPoints() _G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1) _G[bar..'StatusBar']:SetAllPoints(_G[bar]) --glowing borders local h = CreateFrame("Frame", nil, _G[bar]) h:SetFrameLevel(0) h:SetPoint("TOPLEFT",-5,5) h:SetPoint("BOTTOMRIGHT",5,-5) lib.gen_backdrop(h) end end
|
The above code actually breaks the raid frames (odd?). I tested it a few times typing it out myself and directly copying and pasting it in. Also, I just saw /framestack report up to TimerTrackerTimer5 (only one bar total was actually visible) but, my main concern was on line 21. MirrorTimer uses the MirrorTimerStatusBar but TimerTrackerTimer uses TimerTrackerTimerStatusBar. I am assuming that some modification needs to be done to line 21 and I'll have to try it later tonight. I know you just said it helps to try your own code first but, I won't be able to for several hours and I just wanted to post this
in case anyone who might know the answer shows up before I am able to test it out. =)
Here is what I would test:
Lua Code:
_G[bar..'Text']:ClearAllPoints()
If MirrorTimer1 == true Or MirrorTimer2 == true Or MirrorTimer3 == true Then
_G[bar..'Text']:SetPoint('CENTER', MirrorTimer1StatusBar, 0, 1)
Else
_G[bar..'Text']:SetPoint('CENTER', TimerTracker1StatusBar, 0, 1)
End
_G[bar..'StatusBar']:SetAllPoints(_G[bar])
EDIT: The [highlight] won't accept the first set of spaces on the first line.