• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

OTClient Error on setBackGround

_Aion_

Nothing Else
Joined
Jan 19, 2010
Messages
400
Solutions
4
Reaction score
10
Location
Jequie,Bahia,Brazil
Hello. I'm having this error on otclient console
Lua:
stack traceback:
    [builtin#146]: at 0x011ba470
    [C]: in function 'setBackgroundColor'
    /modules/poke_bar/pokebar.lua:118: in function 'receive'
    /modules/poke_bar/pokebar.lua:46: in function </modules/poke_bar/pokebar.lua:25>
ERROR: protected lua call failed: C++ call failed: LUA ERROR: attempt to cast a 'string' lua value to 'class Color'
stack traceback:
    [builtin#146]: at 0x011ba470
    [C]: in function 'setBackgroundColor'
    /modules/poke_bar/pokebar.lua:118: in function 'receive'
    /modules/poke_bar/pokebar.lua:46: in function </modules/poke_bar/pokebar.lua:25>

And this is code that give error
Lua:
pokeBarWindow:getChildById('HP'..i):setBackgroundColor("#ff0000")
    if tonumber(hp) == 0 then
        pokeBarWindow:getChildById('HP'..i):setText("Desmaiado")
        pokeBarWindow:getChildById('HP'..i):setPercent(100);
        pokeBarWindow:getChildById('HP'..i):setBackgroundColor("#202020")
        pokeBarWindow:getChildById('L'..i):setColor("gray")
        pokeBarWindow:getChildById('bar'..i):setImageSource("bar2.png")
    else
        color = color..string.format("%.2x",255-math.ceil(hp)*2.5)..string.format("%.2x",math.ceil(hp)*2.5)..string.format("%.2x",0)
               
        pokeBarWindow:getChildById('HP'..i):setBackgroundColor(color)
        if tonumber(hp) == -1 then
            pokeBarWindow:getChildById('HP'..i):setPercent(100);
            pokeBarWindow:getChildById('HP'..i):setText(string.format( "%3d %%", 100 ) ) ;
        else
            pokeBarWindow:getChildById('HP'..i):setPercent(hp);
            pokeBarWindow:getChildById('HP'..i):setText(hp.."%");
        end
    end

if i remove all code, errors stop, but dont show summon health
 
Back
Top