Post your whole code, not just snippets. It might be easier to use paste.wowace.com or pastey.net so we can download the file. I might have introduced a bug by the location I chose to declare your variables locally, but unless I can see the whole code, there is no way to be certain.
The only things I fixed was making your variables local so they aren't polluting the global name space. I did break up your code with line breaks, but that is just for readability.
local myframe = CreateFrame("Frame", nil, UIParent)
myframe:SetWidth(220)
myframe:SetHeight(50)
myframe:Show()
myframe:RegisterEvent("PLAYER_EQUIPMENT_CHANGED")
myframe:RegisterEvent("UNIT_STATUS")
myframe:RegisterEvent("COMBAT_RATING_UPDATE")
myframe:SetScript("OnEvent", eventHandler) -- where is the event handler? and "eventHandler" is a really bad name, btw
myframe:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
myframe:SetMovable(true)
myframe:EnableMouse(true)
myframe:SetScript("OnMouseDown", function(self, button)
if button == "LeftButton" and not self.isMoving then
self:StartMoving();
self.isMoving = true;
end
end)
myframe:SetScript("OnMouseUp", function(self, button)
if button == "LeftButton" and self.isMoving then
self:StopMovingOrSizing();
self.isMoving = false;
end
end)
myframe:SetBackdrop(GameTooltip:GetBackdrop())
local crtlbl = myframe:CreateFontString(nil, "ARTWORK", "GameFontNormal")
crtlbl:SetPoint("CENTER", myframe, "CENTER", -70, 0)
crtlbl:SetText("crit%: ")
crtlbl:SetFont("Fonts\\FRIZQT__.TTF", 30)
local crtm = myframe:CreateFontString(nil, "ARTWORK", "GameFontNormal")
crtm:SetPoint("CENTER", myframe, "CENTER", -10, 0)
crtm:SetText(format("%.2f", GetCritChance()))
crtm:SetFont("Fonts\\FRIZQT__.TTF", 30)
local crtmax = myframe:CreateFontString(nil, "ARTWORK", "GameFontNormal")
crtmax:SetPoint("CENTER", myframe, "CENTER",60, 0)
crtmax:SetText(critmax)
crtmax:SetFont("Fonts\\FRIZQT__.TTF", 30)
Assuming your code is all you want this to do, then don't use Ace3; which you aren't even using right now, actually. At least not properly. Line 3 should not be local, and the variable critChance is only visible to that function because you defined it as local to that function.
A tip: when posting code, but the [code ] [/code ] brackets around it, or use paste.wowace.com or pastey.net it will make it much easier to read and debug.
That's at first glance.
You also noticed that quoting code doesn't work because it puts smilies into the lines. :D