It's just an suggestion I quickly wrote, did not check if it's valid or if I wrote something wrong but the general idea is that you can make the whole thing in much shorter code:
Code:
local f = CreateFrame("Frame", "EZXPBarXP", "you-should-enter-parent-name-here-as-in-the-name-of-th-expbar-for-example-or-set-this-quote-to-nil", "TextStatusBar")
f:SetPoint("TOPLEFT", f, "TOPLEFT", 5, -5)
f:SetScript("OnEvent", EZXPBar_OnEvent)
f.bar = CreateFrame("BarTexture", f)
f.bar:SetFile([[Interface\TargetingFrame\UI-StatusBar]])
f.bar:SetStatusBarColor(0.5, g, 0.5)
f.txt = CreateFrame("FontString", "EZXPBar_TEXT", nil, "GameFontNormalSmall")
f.txt:SetColor(1, 1, 0)
local function set(text)
if not GetXPExhaustion() then
f.bar:SetStatusBarColor(0.8, 0.6, 0)
f.txt:SetText(COLOR1..dispRP)
else
f.bar:SetStatusBarColor(0, 0, 1)
f.txt:SetText(COLOR1..dispXP)
end
end
Also note that names are not required for reference, local variables work just fine as well.
About the issue, I am not pro enough to see a problem in the code atm.