Hello =)
I'm currently playing around with some status bars, and I've been having some trouble fitting the border textures. As far as I've been able to google myself to, I need to use the SetBackdrop() method, however this places the borders behind my status bar and after even further investigation, I still haven't been able to get them placed in a proper position. I've included an image to clarify what I'm talking about.
Code:
local time = 0
local value = 30
local totalValue = 100
MyStatusBar = CreateFrame("StatusBar", nil, UIParent)
MyStatusBar:SetStatusBarTexture("Interface\\TargetingFrame\\UI-StatusBar")
MyStatusBar:GetStatusBarTexture():SetHorizTile(false)
MyStatusBar:SetMinMaxValues(0, 100)
MyStatusBar:SetValue(totalValue)
MyStatusBar:SetWidth(200)
MyStatusBar:SetHeight(10)
MyStatusBar:SetPoint("CENTER",UIParent,"CENTER")
MyStatusBar:SetStatusBarColor(1,0,0)
MyStatusBar:SetBackdrop({bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
tile = true, tileSize = 32, edgeSize = 8,
insets = { left = 2, right = 2, top = 2, bottom = 2 }
})
MyStatusBar:SetBackdropColor(0,0,0,1)
SLASH_MSB1 = "/msb"
SlashCmdList["MSB"] = function()
MyStatusBar:SetScript("OnUpdate", function(self, elapsed)
time = time + elapsed
local percent = (value-time)/value
MyStatusBar:SetValue(totalValue*percent)
print("hi "..time)
end)
end
SLASH_MSBSTOP1 = "/msb_stop"
SlashCmdList["MSBSTOP"] = function()
MyStatusBar:SetScript("OnUpdate", nil)
end
Statusbar Wrong.PNG