• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Error script.lua

TopllDan

Football <3
Joined
May 14, 2015
Messages
66
Reaction score
0
Hello I am with this error when I go to look and when I try to put it out of pokemon ball Note: the pokemon I'm trying to put it out was captured at once there give error in goback

error
Code:
[04/06/2015 15:28:08] [Error - CreatureScript Interface] 
[04/06/2015 15:28:08] data/creaturescripts/scripts/look.lua:onLook
[04/06/2015 15:28:08] Description: 
[04/06/2015 15:28:08] data/creaturescripts/scripts/look.lua:43: bad argument #1 to 'floor' (number expected, got nil)
[04/06/2015 15:28:08] stack traceback:
[04/06/2015 15:28:08]  [C]: in function 'floor'
[04/06/2015 15:28:08]  data/creaturescripts/scripts/look.lua:43: in function <data/creaturescripts/scripts/look.lua:1>

Look.lua
Code:
function onLook(cid, thing, position, lookDistance)

    local str = ""

    if not isCreature(thing.uid) then

        local iname = getItemInfo(thing.itemid)

        if isPokeball(thing.itemid) then

            local unique = getItemAttribute(thing.uid, "unique")  --alterado v2.6

            local pokename = getItemAttribute(thing.uid, "poke")
            local item = getItemInfo(thing.itemid)
            str = "You see "..item.article.." "..item.name.."." --alterado v2.6
            if unique and unique == getCreatureName(cid) then
              str = str.." It's an unique item."   --alterado v2.6
            end
            str = str.."\nIt contains "..getArticle(pokename).." "..pokename.." [level "..getItemAttribute(thing.uid, "level").."].\n" --alterado v2.6

            --alterado v2.6 
               
            local boost = getItemAttribute(thing.uid, "boost") or 0
            local boostshow = ""

            if boost > 0 then
                str = str.."Boost level: +"..boost..".\n"
            end

            if getItemAttribute(thing.uid, "nick") then
                str = str.."It's nickname is: "..getItemAttribute(thing.uid, "nick")..".\n"
            end
       
            if getItemAttribute(thing.uid, "gender") == SEX_MALE then
                str = str.."It is male."
            elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
                str = str.."It is female."
            else
                str = str.."It is genderless."
            end
   
            str = str.."\n--- Status ---"
            str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"
            str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"
            str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality"))..""   

        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

        return false

        elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then

            str = "You see a "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."].\n"

            if getItemAttribute(thing.uid, "gender") == SEX_MALE then
                str = str.."It is male."
            elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
                str = str.."It is female."
            else
                str = str.."It is genderless."
            end
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

        return false

        else

        return true

        end
    end

local NPCBattle = {
["Brock"] = {artig = "He is", cidbat = "Pewter"},
["Misty"] = {artig = "She is", cidbat = "Cerulean"}, 
}  
                                                       --edited npc name
NPCname = {"Brock", "Misty"}

local npcname = getCreatureName(thing.uid)
if not isPlayer(thing.uid) and not isMonster(thing.uid) and isInArray(NPCname, npcname) then
   str = "You see "..npcname..". "..NPCBattle[npcname].artig.." a pokemon trainer from "..NPCBattle[npcname].cidbat.."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end

if not isPlayer(thing.uid) and not isMonster(thing.uid) then    
   str = "You see "..getCreatureName(thing.uid).."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end

look = {
[1] = {"a Volcanic Spark", "a Volcanic Flame","a Volcanic Firetamer","a Volcanic Pyromancer","a Volcanic Master"},
[2] = {"a Seavell Drop", "a Seavell Icelake","a Seavell Waterfall","a Seavell Frost","a Seavell Master"},
[3] = {"an Orebound Sand", "an Orebound Rock","an Orebound Solid","an Orebound Hardskin","an Orebound Hero"},
[4] = {"a Wingeon Cloud", "a Wingeon Wind","a Wingeon Sky","a Wingeon Falcon","a Wingeon Dragon"},
[5] = {"a Malefic Troublemaker", "a Malefic Venomancer","a Malefic Spectre","a Malefic Nightwalker","a Malefic Master"},
[6] = {"a Gardestrike Fist", "a Gardestrike Tamer","a Gardestrike Fighter","a Gardestrike DeathHand","a Gardestrike Champion"},
[7] = {"a Psycraft Mind", "a Psycraft Brain","a Psycraft Scholar","a Psycraft Telepath","a Psycraft Medium"},
[8] = {"a Naturia Seed", "a Naturia Sprout","a Naturia Webhead","a Naturia Woodtrunk","a Naturia Keeper"},
[9] = {"a Raibolt Shock", "a Raibolt Watt","a Raibolt Electrician","a Raibolt Overcharged","a Raibolt Legend"},
}

youAre = {
[3] = "a Senior Tutor",
[4] = "a Game Master",
[5] = "a Sub",                     --alterado v2.3
[6] = "a GOD"
}

if thing.uid == cid then
     
   if getPlayerStorageValue(thing.uid, 86228) <= 0 then
      if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then    --alterado v2.3
          pos = getCreaturePosition(thing.uid)
          ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
          str = "You see yourself. You are "..ocupacao..".\n"
          str = str.."Pos: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
      else
          str = "You see yourself. You are a Pokemon Trainer."
      end
     
   else
      vocation = getPlayerStorageValue(thing.uid, 86228)
      rank = getPlayerStorageValue(thing.uid, 862281)
      promote = look[vocation][rank]   
      if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then
          pos = getCreaturePosition(thing.uid)
          ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
          str = "You see yourself. You are "..ocupacao.." and "..promote..".\n"
          str = str.."Pos: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
      else
          str = "You see yourself. You are "..promote.."."
      end
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)

return false
end   
                                                                    --edited clan system


if isPlayer(thing.uid) and thing.uid ~= cid then

   vocation2 = getPlayerStorageValue(thing.uid, 86228) 
   rank2 = getPlayerStorageValue(thing.uid, 862281)

   if getPlayerStorageValue(thing.uid, 86228) <= 0 then
      promote2 = "a Pokemon Trainer"
   else
      promote2 = look[vocation2][rank2]
   end

   if getPlayerSex(thing.uid) == 1 then
      artic = "He is"           
   elseif getPlayerSex(thing.uid) == 0 then
      artic = "She is"
   end   
   
   if getPlayerGroupId(thing.uid) >= 3 and getPlayerGroupId(thing.uid) <= 6 then   --alterado v2.3
       pos = getCreaturePosition(thing.uid)
       ocupacao = youAre[getPlayerGroupId(thing.uid)]          --alterado v2.3
       str = "You see "..getCreatureName(thing.uid)..". "..artic.." "..ocupacao.." and "..promote2..".\n"
       str = str.."Poss: {x = "..pos.x..", y = "..pos.y..", z = "..pos.z.."}."
   else
       str = "You see "..getCreatureName(thing.uid)..". "..artic.." "..promote2.."."
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
               
return false
end

    if getCreatureName(thing.uid) == "Evolution" then return false end

    if not isSummon(thing.uid) then
        local str = "You see a wild "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"
        if getPokemonGender(thing.uid)  == SEX_MALE then
            str = str.."It is male."
        elseif getPokemonGender(thing.uid)  == SEX_FEMALE then
            str = str.."It is female."
        else
            str = str.."It is genderless."
        end
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return false
    elseif isSummon(thing.uid) and not isPlayer(thing.uid) then

        local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0
        local boostshow = " + "..boostlevel.."]"

        if showBoostSeparated then
            boostshow = "] [+"..boostlevel.."]"
        end

        local levelinfo = "["..getPokemonLevel(thing.uid)..""..boostshow..""

        if getCreatureMaster(thing.uid) == cid then
            local myball = getPlayerSlotItem(cid, 8).uid
            local nexp = getItemAttribute(myball, "nextlevelexp")

            local string = "You see your "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."."
            string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid).."."
            string = string.."\n"..getPokemonHappinessDescription(thing.uid)
                if getItemAttribute(myball, "level") <= 99 then
                    string = string.."\nExperience needed to level up: "..nexp.."."
                end
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
        else
            doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see a "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..".\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
        end


    return false
    end

return true
end
 
Last edited:
I found this part in luascript.cpp
Code:
    //getItemAttribute(uid, key)
    lua_register(m_luaState, "getItemAttribute", LuaScriptInterface::luaGetItemAttribute);
Code:
int32_t LuaScriptInterface::luaGetItemAttribute(lua_State* L)
{
    //getItemAttribute(uid, key)
    std::string key = popString(L);
    ScriptEnviroment* env = getEnv();

    Item* item = env->getItemByUID(popNumber(L));
    if(!item)
    {
        //errorEx(getError(LUA_ERROR_ITEM_NOT_FOUND));
        lua_pushnil(L);
        return 1;
    }

    boost::any value = item->getAttribute(key);
    if(value.empty())
        lua_pushnil(L);
    else if(value.type() == typeid(std::string))
        lua_pushstring(L, boost::any_cast<std::string>(value).c_str());
    else if(value.type() == typeid(int32_t))
        lua_pushnumber(L, boost::any_cast<int32_t>(value));
    else if(value.type() == typeid(float))
        lua_pushnumber(L, boost::any_cast<float>(value));
    else if(value.type() == typeid(bool))
        lua_pushboolean(L, boost::any_cast<bool>(value));
    else
        lua_pushnil(L);

    return 1;
}
I found this part in luascript.h
Code:
        static int32_t luaGetItemAttribute(lua_State* L);
        static int32_t luaDoItemSetAttribute(lua_State* L);
        static int32_t luaDoItemEraseAttribute(lua_State* L);
 
Dafuq, excepted some enum it would link to..
Try to serach for any_cast idk if that is a thing that the boost has or if it is something they added to it, since how would the boost otherwise know what to return?
 
Dafuq, excepted some enum it would link to..
Try to serach for any_cast idk if that is a thing that the boost has or if it is something they added to it, since how would the boost otherwise know what to return?
I looked and it was found that
creature.h
Code:
struct DeathLessThan;
struct DeathEntry
{
        DeathEntry(std::string name, int32_t dmg):
            data(name), damage(dmg), unjustified(false) {}
        DeathEntry(Creature* killer, int32_t dmg):
            data(killer), damage(dmg), unjustified(false) {}
        void setUnjustified(bool v) {unjustified = v;}

        bool isCreatureKill() const {return data.type() == typeid(Creature*);}
        bool isNameKill() const {return !isCreatureKill();}
        bool isUnjustified() const {return unjustified;}

        const std::type_info& getKillerType() const {return data.type();}
        Creature* getKillerCreature() const {return boost::any_cast<Creature*>(data);}
        std::string getKillerName() const {return boost::any_cast<std::string>(data);}

    protected:
        boost::any data;
        int32_t damage;
        bool unjustified;

        friend struct DeathLessThan;
};

itemattributes.cpp
Code:
void ItemAttribute::set(boost::any a)
{
    clear();
    if(a.empty())
        return;

    if(a.type() == typeid(std::string))
    {
        type = STRING;
        new(data) std::string(boost::any_cast<std::string>(a));
    }
    else if(a.type() == typeid(int32_t))
    {
        type = INTEGER;
        *reinterpret_cast<int32_t*>(&data) = boost::any_cast<int32_t>(a);
    }
    else if(a.type() == typeid(float))
    {
        type = FLOAT;
        *reinterpret_cast<float*>(&data) = boost::any_cast<float>(a);
    }
    else if(a.type() == typeid(bool))
    {
        type = BOOLEAN;
        *reinterpret_cast<bool*>(&data) = boost::any_cast<bool>(a);
    }
}

luascript.cpp
Code:
    const std::type_info& type = value.type();
    if(!caseSensitive && type == typeid(std::string))
        value = asLowerCaseString(boost::any_cast<std::string>(value));

    if(!lua_istable(L, -1))
    {
        boost::any data;
        if(lua_isnumber(L, -1))
            data = popFloatNumber(L);
        else if(lua_isboolean(L, -1))
            data = popBoolean(L);
        else if(lua_isstring(L, -1))
            data = popString(L);
        else
        {
            lua_pop(L, 1);
            lua_pushboolean(L, false);
            return 1;
        }

        if(type != data.type()) // check is it even same data type before searching deeper
            lua_pushboolean(L, false);
        else if(type == typeid(bool))
            lua_pushboolean(L, boost::any_cast<bool>(value) == boost::any_cast<bool>(data));
        else if(type == typeid(double))
            lua_pushboolean(L, boost::any_cast<double>(value) == boost::any_cast<double>(data));
        else if(caseSensitive)
            lua_pushboolean(L, boost::any_cast<std::string>(value) == boost::any_cast<std::string>(data));
        else
            lua_pushboolean(L, boost::any_cast<std::string>(value) == asLowerCaseString(boost::any_cast<std::string>(data)));

        return 1;
    }

    lua_pushnil(L);
    while(lua_next(L, -2))
    {
        boost::any data;
        if(lua_isnumber(L, -1))
            data = popFloatNumber(L);
        else if(lua_isboolean(L, -1))
            data = popBoolean(L);
        else if(lua_isstring(L, -1))
            data = popString(L);
        else
        {
            lua_pop(L, 1);
            break;
        }

        if(type != data.type()) // check is it same data type before searching deeper
            continue;

        if(type == typeid(bool))
        {
            if(boost::any_cast<bool>(value) != boost::any_cast<bool>(data))
                continue;

            lua_pushboolean(L, true);
            return 1;
        }
        else if(type == typeid(double))
        {
            if(boost::any_cast<double>(value) != boost::any_cast<double>(data))
                continue;

            lua_pushboolean(L, true);
            return 1;
        }
        else if(caseSensitive)
        {
            if(boost::any_cast<std::string>(value) != boost::any_cast<std::string>(data))
                continue;

            lua_pushboolean(L, true);
            return 1;
        }
        else if(boost::any_cast<std::string>(value) == asLowerCaseString(boost::any_cast<std::string>(data)))
        {
            lua_pushboolean(L, true);
            return 1;
        }
    }
in yet luascript.cpp
Code:
    boost::any value = item->getAttribute(key);
    if(value.empty())
        lua_pushnil(L);
    else if(value.type() == typeid(std::string))
        lua_pushstring(L, boost::any_cast<std::string>(value).c_str());
    else if(value.type() == typeid(int32_t))
        lua_pushnumber(L, boost::any_cast<int32_t>(value));
    else if(value.type() == typeid(float))
        lua_pushnumber(L, boost::any_cast<float>(value));
    else if(value.type() == typeid(bool))
        lua_pushboolean(L, boost::any_cast<bool>(value));
    else
        lua_pushnil(L);

    return 1;
}
 
error
Code:
[24/05/2015 09:33:08] [Error - CreatureScript Interface]
[24/05/2015 09:33:08] data/creaturescripts/scripts/look.lua:onLook
[24/05/2015 09:33:08] Description:
[24/05/2015 09:33:08] data/creaturescripts/scripts/look.lua:58: attempt to concatenate a nil value
[24/05/2015 09:33:08] stack traceback:
[24/05/2015 09:33:09]     data/creaturescripts/scripts/look.lua:58: in function <data/creaturescripts/scripts/look.lua:1>
look.lua
Code:
function onLook(cid, thing, position, lookDistance)
local str = ""

if not isCreature(thing.uid) then
   local iname = getItemInfo(thing.itemid)
if not isPokeball(thing.itemid) then
    if thing.itemid == 3058 then
    str = "Você está vendo "..getItemInfo(thing.itemid).name.." (Vol:"..getContainerSize(thing.uid)..")."
    pName = getItemAttribute(thing.uid, "pName") or "Nobody"
    atk = getItemAttribute(thing.uid, "attacker") or "Unknown"
    str = str.."\nVocê está vendo "..pName..", morto por "..atk.."."
    if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
    str = str.."\nItemID: ["..thing.itemid.."]."                                                                                                      --alterado v1.7
    local pos = getThingPos(thing.uid)
    str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return false
    elseif priceList[getItemInfo(thing.itemid).name] then
    price = priceList[getItemInfo(thing.itemid).name].price
    if thing.type > 1 then
    str = "Você está vendo "..thing.type.." "..getItemInfo(thing.itemid).plural.."."
    price = price * thing.type
    else
    str = "Você está vendo "..getItemInfo(thing.itemid).article.." "..getItemInfo(thing.itemid).name.."."
    end
    str = str.." Price: $"..price.."."
    if getItemAttribute(thing.uid, "description") then
    str = str.."\n"..getItemAttribute(thing.uid, "description").."."
    end
    if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
    str = str.."\nItemID: ["..thing.itemid.."]."                                                                                                      --alterado v1.7
    local pos = getThingPos(thing.uid)
    str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return false
    end
    end 

if isPokeball(thing.itemid) then
      local lock = getItemAttribute(thing.uid, "lock")        --alterado v2.8
      local pokename = getItemAttribute(thing.uid, "poke")
      local item = getItemInfo(thing.itemid)
      str = "Voce esta vendo "..item.article.." "..string.gsub(item.name,"ball"," ball").."." --alterado v2.6
      if getItemAttribute(thing.uid, "unique") then                --alterado v2.8
         str = str.." Este item e so seu."   --alterado v2.6
      end
      str = str.."\nContem "..getArticle(pokename).." "..pokename.."" --alterado v2.6
      if getItemAttribute(thing.uid, "nick") then
         str = str.." ("..getItemAttribute(thing.uid, "nick")..")"
      end
      local boost = getItemAttribute(thing.uid, "boost") or 0
      local boostshow = ""
      if boost > 0 then
         str = str.." +"..boost..""
      end
    str = str.." [level "..getItemAttribute(thing.uid, "level").."]"

      if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         str = str.." Masculino"
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         str = str.." Feminino"
      end
    str = str.."."
      if lock and lock > 0 then
         str = str.."Este item ira destravar em ".. os.date("%d/%m/%y %X", lock).."."  --alterado v2.8
      end
     str = str.."\n--- Status ---"   
      str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"
      str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"
      str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality"))..""  
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then
    
      str = "Voce esta vendo "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."]. "    --alterado v2.8 \/
      if isContainer(thing.uid) then
         str = str.."(Vol: "..getContainerCap(thing.uid)..")"
      end
      str = str.."\n"

      if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         str = str.."Masculino."
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         str = str.."Feminino."
      else
         str = str.."It is genderless."
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif isContainer(thing.uid) then     --containers
    
      local info = getItemInfo(thing.itemid)                                         --alterado v2.7
      if info.name == "Treinador morto" and getItemAttribute(thing.uid, "pName") then
         str = "Voce esta vendo um noob morto (Vol:"..getContainerCap(thing.uid).."). "
         str = str.."Voce identificou um ".. getItemAttribute(thing.uid, "pName")..". ".. getItemAttribute(thing.uid, "article").." foi morto por um "
         str = str.."".. getItemAttribute(thing.uid, "attacker").."."
      else 
         str = "Voce esta vendo "..info.article.." "..info.name..". (Vol:"..getContainerCap(thing.uid)..")"
      end
      if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
         str = str.."\nItemID: ["..thing.itemid.."]"                              --alterado v2.8
         local pos = getThingPos(thing.uid)
         str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"   --alterado v2.8
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif getItemAttribute(thing.uid, "unique") then    --alterado v2.8 \/
      local info = getItemInfo(thing.itemid)
      local p = getThingPos(thing.uid)
  
      local str = "Voce esta vendo "
      if thing.type > 0 then
         str = str..thing.type.." "..info.plural.."."
      else
         str = str..info.article.." "..info.name.."."
      end
      str = str.." Este item e so seu.\n"
    
      str = str..info.description.."\nItemID: ["..thing.itemid.."]"
      str = str.."\nPosition: ["..p.x.."]["..p.y.."]["..p.z.."]"
  
      sendMsgToPlayer(cid, MESSAGE_INFO_DESCR, str)
      return false
   else
      return true
   end
end

local NPCBattle = {
["Brock"] = {artig = "He is", cidbat = "Pewter"},
["Misty"] = {artig = "She is", cidbat = "Cerulean"},
} 

local npcname = getCreatureName(thing.uid)
if ehNPC(thing.uid) and NPCBattle[npcname] then    --npcs duel
   str = "Voce esta vendo "..npcname..". "..NPCBattle[npcname].artig.." leader of the gym from "..NPCBattle[npcname].cidbat.."."   --alterado v2.7
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
elseif ehNPC(thing.uid) and getPlayerStorageValue(thing.uid, 697548) ~= -1 then    --npcs de TV
   local str = getPlayerStorageValue(thing.uid, 697548)                                   --alterado v2.7
   local pos = getThingPos(thing.uid)
   str = "Voce e [getPlayerGroupId(cid)] and str..\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]." or str
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) 
   return false
end

if not isPlayer(thing.uid) and not isMonster(thing.uid) then   
   str = "Voce esta vendo "..getCreatureName(thing.uid).."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end

if isPlayer(thing.uid) then     --player
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getPlayerDesc(cid, thing.uid, false))  --alterado v2.7
return false
end

if getCreatureName(thing.uid) == "Evolution" then return false end

if not isSummon(thing.uid) then
   local str = "Voce esta vendo "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"
   if getPokemonGender(thing.uid)  == SEX_MALE then
      str = str.."Masculino"
   elseif getPokemonGender(thing.uid)  == SEX_FEMALE then
      str = str.."Feminino."
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
elseif isSummon(thing.uid) and not isPlayer(thing.uid) then
   local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0
   local boostshow = "[+ "..boostlevel.."["
   if showBoostSeparated then
      boostshow = "+"..boostlevel.." ["
   end
   local levelinfo = ""..boostshow..""..getPokemonLevel(thing.uid).."]"
   if getCreatureMaster(thing.uid) == cid then
      local myball = getPlayerSlotItem(cid, 8).uid
      local nexp = getItemAttribute(myball, "nextlevelexp")
      local string = "Voce esta vendo seu "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..""
      string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid)..""
      string = string.."\n"..getPokemonHappinessDescription(thing.uid)
      if getItemAttribute(myball, "level") <= 99 then
         string = string.."\nExperience needed to level up: "..nexp.."."
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
   else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce esta vendo "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
   end
   return false
end
return true
end
the stranger it is only then after it is captured, when I do at / cb give him regular look
 
Last edited:
the stranger it is only then after it is captured, when I do at / cb give him regular look

UP
 
Last edited by a moderator:
As I said use a better translator, either scrap that datapack or rewrite everything, the code is a fking mess...
You do know that you aren't allowed to post more the once in 24h, only exception is if you do it to post the solution to the issue.
Ive reported the posts for that.
 
As I said use a better translator, either scrap that datapack or rewrite everything, the code is a fking mess...
You do know that you aren't allowed to post more the once in 24h, only exception is if you do it to post the solution to the issue.
Ive reported the posts for that.
Sorry, no how to fix?
 
I have to agree, this entire thing is a complete mess.
This is probably what throws you the error:
Code:
str = str.." [level "..getItemAttribute(thing.uid, "level").."]"
change it to:
Code:
str = str.." [level ".. getItemAttribute(thing.uid, "level") or 1 .."]"
 
I have to agree, this entire thing is a complete mess.
This is probably what throws you the error:
Code:
str = str.." [level "..getItemAttribute(thing.uid, "level").."]"
change it to:
Code:
str = str.." [level ".. getItemAttribute(thing.uid, "level") or 1 .."]"
It is a mess same :(
error continues
Code:
[25/05/2015 12:59:32] [Error - CreatureScript Interface]
[25/05/2015 12:59:32] data/creaturescripts/scripts/look.lua:onLook
[25/05/2015 12:59:32] Description:
[25/05/2015 12:59:32] data/creaturescripts/scripts/look.lua:58: attempt to concatenate a nil value
[25/05/2015 12:59:32] stack traceback:
[25/05/2015 12:59:32]     data/creaturescripts/scripts/look.lua:58: in function <data/creaturescripts/scripts/look.lua:1>
the stranger it is only then after it is captured, when I do at / cb give him regular look
 
show me your script as it is now, as it doesn't seem you changed what I gave you.
I left so
Code:
function onLook(cid, thing, position, lookDistance)
local str = ""

if not isCreature(thing.uid) then
   local iname = getItemInfo(thing.itemid)
if not isPokeball(thing.itemid) then
    if thing.itemid == 3058 then
    str = "Você está vendo "..getItemInfo(thing.itemid).name.." (Vol:"..getContainerSize(thing.uid)..")."
    pName = getItemAttribute(thing.uid, "pName") or "Nobody"
    atk = getItemAttribute(thing.uid, "attacker") or "Unknown"
    str = str.."\nVocê está vendo "..pName..", morto por "..atk.."."
    if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
    str = str.."\nItemID: ["..thing.itemid.."]."                                                                                                      --alterado v1.7
    local pos = getThingPos(thing.uid)
    str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return false
    elseif priceList[getItemInfo(thing.itemid).name] then
    price = priceList[getItemInfo(thing.itemid).name].price
    if thing.type > 1 then
    str = "Você está vendo "..thing.type.." "..getItemInfo(thing.itemid).plural.."."
    price = price * thing.type
    else
    str = "Você está vendo "..getItemInfo(thing.itemid).article.." "..getItemInfo(thing.itemid).name.."."
    end
    str = str.." Price: $"..price.."."
    if getItemAttribute(thing.uid, "description") then
    str = str.."\n"..getItemAttribute(thing.uid, "description").."."
    end
    if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
    str = str.."\nItemID: ["..thing.itemid.."]."                                                                                                      --alterado v1.7
    local pos = getThingPos(thing.uid)
    str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"
    end
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
    return false
    end
    end 

if isPokeball(thing.itemid) then
      local lock = getItemAttribute(thing.uid, "lock")        --alterado v2.8
      local pokename = getItemAttribute(thing.uid, "poke")
      local item = getItemInfo(thing.itemid)
      str = "Voce esta vendo "..item.article.." "..string.gsub(item.name,"ball"," ball").."." --alterado v2.6
      if getItemAttribute(thing.uid, "unique") then                --alterado v2.8
         str = str.." Este item e so seu."   --alterado v2.6
      end
      str = str.."\nContem "..getArticle(pokename).." "..pokename.."" --alterado v2.6
      if getItemAttribute(thing.uid, "nick") then
         str = str.." ("..getItemAttribute(thing.uid, "nick")..")"
      end
      local boost = getItemAttribute(thing.uid, "boost") or 0
      local boostshow = ""
      if boost > 0 then
         str = str.." +"..boost..""
      end
    str = str.." [level ".. getItemAttribute(thing.uid, "level") or 1 .."]"

      if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         str = str.." Masculino"
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         str = str.." Feminino"
      end
    str = str.."."
      if lock and lock > 0 then
         str = str.."Este item ira destravar em ".. os.date("%d/%m/%y %X", lock).."."  --alterado v2.8
      end
     str = str.."\n--- Status ---"  
      str = str.."\nOffense: "..math.floor(getItemAttribute(thing.uid, "offense")).." Defense: "..math.floor(getItemAttribute(thing.uid, "defense")).."\n"
      str = str.."Agility: "..math.floor(getItemAttribute(thing.uid, "speed")).." Sp. Attack: "..math.floor(getItemAttribute(thing.uid, "specialattack")).."\n"
      str = str.."Vitality: "..math.floor(getItemAttribute(thing.uid, "vitality"))..""  
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif string.find(iname.name, "fainted") or string.find(iname.name, "defeated") then
   
      str = "Voce esta vendo "..string.lower(iname.name).." ["..getItemAttribute(thing.uid, "level").."]. "    --alterado v2.8 \/
      if isContainer(thing.uid) then
         str = str.."(Vol: "..getContainerCap(thing.uid)..")"
      end
      str = str.."\n"

      if getItemAttribute(thing.uid, "gender") == SEX_MALE then
         str = str.."Masculino."
      elseif getItemAttribute(thing.uid, "gender") == SEX_FEMALE then
         str = str.."Feminino."
      else
         str = str.."It is genderless."
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif isContainer(thing.uid) then     --containers
   
      local info = getItemInfo(thing.itemid)                                         --alterado v2.7
      if info.name == "Treinador morto" and getItemAttribute(thing.uid, "pName") then
         str = "Voce esta vendo um noob morto (Vol:"..getContainerCap(thing.uid).."). "
         str = str.."Voce identificou um ".. getItemAttribute(thing.uid, "pName")..". ".. getItemAttribute(thing.uid, "article").." foi morto por um "
         str = str.."".. getItemAttribute(thing.uid, "attacker").."."
      else 
         str = "Voce esta vendo "..info.article.." "..info.name..". (Vol:"..getContainerCap(thing.uid)..")"
      end
      if getPlayerGroupId(cid) >= 4 and getPlayerGroupId(cid) <= 6 then
         str = str.."\nItemID: ["..thing.itemid.."]"                              --alterado v2.8
         local pos = getThingPos(thing.uid)
         str = str.."\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]"   --alterado v2.8
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
      return false
   elseif getItemAttribute(thing.uid, "unique") then    --alterado v2.8 \/
      local info = getItemInfo(thing.itemid)
      local p = getThingPos(thing.uid)
      local str = "Voce esta vendo "
      if thing.type > 0 then
         str = str..thing.type.." "..info.plural.."."
      else
         str = str..info.article.." "..info.name.."."
      end
      str = str.." Este item e so seu.\n"
   
      str = str..info.description.."\nItemID: ["..thing.itemid.."]"
      str = str.."\nPosition: ["..p.x.."]["..p.y.."]["..p.z.."]"
      sendMsgToPlayer(cid, MESSAGE_INFO_DESCR, str)
      return false
   else
      return true
   end
end

local NPCBattle = {
["Brock"] = {artig = "He is", cidbat = "Pewter"},
["Misty"] = {artig = "She is", cidbat = "Cerulean"},
} 

local npcname = getCreatureName(thing.uid)
if ehNPC(thing.uid) and NPCBattle[npcname] then    --npcs duel
   str = "Voce esta vendo "..npcname..". "..NPCBattle[npcname].artig.." leader of the gym from "..NPCBattle[npcname].cidbat.."."   --alterado v2.7
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
elseif ehNPC(thing.uid) and getPlayerStorageValue(thing.uid, 697548) ~= -1 then    --npcs de TV
   local str = getPlayerStorageValue(thing.uid, 697548)                                   --alterado v2.7
   local pos = getThingPos(thing.uid)
   str = "Voce e [getPlayerGroupId(cid)] and str..\nPosition: [X: "..pos.x.."][Y: "..pos.y.."][Z: "..pos.z.."]." or str
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str) 
   return false
end

if not isPlayer(thing.uid) and not isMonster(thing.uid) then  
   str = "Voce esta vendo "..getCreatureName(thing.uid).."."
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
end

if isPlayer(thing.uid) then     --player
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, getPlayerDesc(cid, thing.uid, false))  --alterado v2.7
return false
end

if getCreatureName(thing.uid) == "Evolution" then return false end

if not isSummon(thing.uid) then
   local str = "Voce esta vendo "..string.lower(getCreatureName(thing.uid)).." [level "..getPokemonLevel(thing.uid).."].\n"
   if getPokemonGender(thing.uid)  == SEX_MALE then
      str = str.."Masculino"
   elseif getPokemonGender(thing.uid)  == SEX_FEMALE then
      str = str.."Feminino."
   end
   doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, str)
   return false
elseif isSummon(thing.uid) and not isPlayer(thing.uid) then
   local boostlevel = getItemAttribute(getPlayerSlotItem(getCreatureMaster(thing.uid), 8).uid, "boost") or 0
   local boostshow = "[+ "..boostlevel.."["
   if showBoostSeparated then
      boostshow = "+"..boostlevel.." ["
   end
   local levelinfo = ""..boostshow..""..getPokemonLevel(thing.uid).."]"
   if getCreatureMaster(thing.uid) == cid then
      local myball = getPlayerSlotItem(cid, 8).uid
      local nexp = getItemAttribute(myball, "nextlevelexp")
      local string = "Voce esta vendo seu "..string.lower(getCreatureName(thing.uid)).." "..levelinfo..""
      string = string.."\nHit points: "..getCreatureHealth(thing.uid).."/"..getCreatureMaxHealth(thing.uid)..""
      string = string.."\n"..getPokemonHappinessDescription(thing.uid)
      if getItemAttribute(myball, "level") <= 99 then
         string = string.."\nExperience needed to level up: "..nexp.."."
      end
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string)
   else
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce esta vendo "..string.lower(getCreatureName(thing.uid)).." "..levelinfo.."\nIt belongs to "..getCreatureName(getCreatureMaster(thing.uid))..".")
   end
   return false
end
return true
end
 
Dear lord this thread is still going on... It is obvious that the attribute "level" does not exist on the item you are looking at.
If you say it works until the pokemon is summoned then it is likely due to some other script related to this system is causing the attribute to be removed hence look.lua:19: attempt to concatenate a nil value
My guess would be that the script that summons the pokemon is removing the "level" attribute.

Again this is all based on what has been said so far, the english is pretty hard to understand.

Edit:
Almost forgot! You are going to have to show us the entire system in all honesty. It is clear that the onLook function is not the problem. In fact, onLook not working is the least of your worries due to the fact that your goback script is failing which I am guessing is causing the entire system to break because again (I am guessing here) the goback script puts the pokemon back into the ball which if failed causes that entire ball to become "bugged".
 
Last edited:
Dear lord this thread is still going on... It is obvious that the attribute "level" does not exist on the item you are looking at.
If you say it works until the pokemon is summoned then it is likely due to some other script related to this system is causing the attribute to be removed hence look.lua:19: attempt to concatenate a nil value
My guess would be that the script that summons the pokemon is removing the "level" attribute.

Again this is all based on what has been said so far, the english is pretty hard to understand.

Edit:
Almost forgot! You are going to have to show us the entire system in all honesty. It is clear that the onLook function is not the problem. In fact, onLook not working is the least of your worries due to the fact that your goback script is failing which I am guessing is causing the entire system to break because again (I am guessing here) the goback script puts the pokemon back into the ball which if failed causes that entire ball to become "bugged".

Sorry not understand English very well, but you talked o'que do I have to do in other systems? what do you mean? I can not remove this attribute that shows the level to solve the problem?
 
Back
Top