Thread: bXP Error
View Single Post
11-06-14, 06:26 AM   #1
Mirrikh
A Flamescale Wyrmkin
 
Mirrikh's Avatar
AddOn Compiler - Click to view compilations
Join Date: Sep 2011
Posts: 111
bXP Error

I seem to be getting this error from the xp addon I'm using
Code:
 bXP\bXP-1.0.lua:98: attempt to call global 'formatNumber' (a nil value)
bXP\bXP-1.0.lua:98: in function <bXP\bXP.lua:65>
not sure how to fix
Here's the relevant code
Code:
bar:SetScript("OnEvent", function()
    xp = UnitXP("player")
    mxp = UnitXPMax("player")
    rxp = GetXPExhaustion("player")
    name, standing, minrep, maxrep, value = GetWatchedFactionInfo()
    
    xpbar:SetMinMaxValues(0,mxp)
    if UnitLevel("player") == MAX_PLAYER_LEVEL or IsXPUserDisabled == true then
        if name then
            xpbar:SetStatusBarColor(FACTION_BAR_COLORS[standing].r, FACTION_BAR_COLORS[standing].g, FACTION_BAR_COLORS[standing].b, 1)
			xpbar:SetMinMaxValues(minrep,maxrep)
			xpbar:SetValue(value)
			xpbar.text:SetText(value-minrep.." / "..maxrep-minrep.." | "..floor(((value-minrep)/(maxrep-minrep))*1000)/10 .."% | ".. name)
            bar:Show()
        else
			bar:Hide()
        end
    else
        xpbar:SetStatusBarColor(unpack(config.color))
		xpbar:SetValue(xp)
		if rxp then
			xpbar.text:SetText(format(xp).." / "..format(mxp).." | "..floor((xp/mxp)*1000)/10 .."%" .. " (+"..format(rxp)..")")
			xpbar:SetMinMaxValues(0,mxp)
			xpbar:SetStatusBarColor(unpack(config.restedcolor))
			xpbar:SetValue(xp)
			if (rxp+xp) >= mxp then
				rxpbar:SetValue(mxp)
			else
				rxpbar:SetValue(rxp+xp)
			end
			rxpbar:Show()
			bar:Show()
		elseif xp then
			xpbar.text:SetText(formatNumber(xp).." / "..formatNumber(mxp).." | "..floor((xp/mxp)*1000)/10 .."%")
			rxpbar:Hide()
		end
    end
end)
  Reply With Quote