This site works best with JavaScript enabled. Please enable JavaScript to get the best experience from this site.
local maxCrit = 0 local f = CreateFrame("Frame", "MyCritFrame", UIParent) f:SetPoint("CENTER", UIParent, "CENTER", 0, 0) f:SetWidth(150) f:SetHeight(50) f:Show() f:SetBackdrop(GameTooltip:GetBackdrop()) f:SetBackdropColor(0, 0, 0, 0.8) f:SetBackdropBorderColor(0.6, 0.6, 0.6, 1) f:SetMovable(true) f:EnableMouse(true) f:RegisterForDrag("LeftButton") f:SetScript("OnDragStart", f.StartMoving) f:SetScript("OnDragStop", f.StopMovingOrSizing) f:SetScript("OnHide", f.StopMovingOrSizing) f.label = f:CreateFontString(nil, "ARTWORK") f.label:SetPoint("LEFT", f, "LEFT", 10, 0) f.label:SetFont("Fonts\\FRIZQT__.TTF", 30) f.label:SetText("Crit:") f.label:SetJustifyH("LEFT") f.text = f:CreateFontString(nil, "ARTWORK") f.text:SetPoint("LEFT", f.label, "RIGHT", 5, 0) f.text:SetFont("Fonts\\FRIZQT__.TTF", 30) f.text:SetJustifyH("RIGHT") f.textMax = f:CreateFontString(nil, "ARTWORK") f.textMax:SetPoint("LEFT", f.text, "RIGHT", 5, 0) f.textMax:SetPoint("RIGHT", f, "RIGHT", 0, -10) f.textMax:SetFont("Fonts\\FRIZQT__.TTF", 30) f.textMax:SetJustifyH("RIGHT") f:RegisterEvent("COMBAT_RATING_UPDATE") f:RegisterEvent("UNIT_STATS") f:SetScript("OnEvent", function(self, event, unit) if event == "UNIT_STATS" and unit ~= "player" then return end local crit = GetCritChance() self.text:SetFormattedText("%.2f", crit) if crit > maxCrit then maxCrit = crit self.textMax:SetFormattedText("%.2f", maxCrit) end end)
myframe:SetBackdrop({ bgFile = [[Interface\DialogFrame\UI-DialogBox-Background]], edgeFile = [[Interface\DialogFrame\UI-DialogBox-Border]], tile = true, tileSize = 32, edgeSize = 32, insets = { left = 11, right = 12, top = 12, bottom = 11 }, })
myframe:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
Also, in the future, please use [ CODE ] tags around your code. Trying to read more than 2-3 lines without proper indentation sucks.