• 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!

TFS 0.X Stop printing errors in console

marek12

Available for sprite works
Joined
Apr 8, 2020
Messages
398
Solutions
4
Reaction score
394
Hello guys, does anyone know how to stop printing errors in console when I try for example summoning a creature which not exist?

Code:
[19:49:29.436] [Error - TalkAction Interface]
[19:49:29.442] data/talkactions/scripts/creature.lua:onSay
[19:49:29.448] Description:
[19:49:29.451] (LuaInterface::luaDoCreateMonster) Monster with name 'squirel' not found

here is the .lua code

Code:
function onSay(cid, words, param)
local func = doCreateMonster
if(words:sub(2, 2) == "n") then
func = doCreateNpc
end

local position = getCreaturePosition(cid)
local effect = CONST_ME_MAGIC_RED
if(func(param, position) == LUA_ERROR) then
effect = CONST_ME_POFF
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTENOUGHROOM)
end

doSendMagicEffect(position, effect)
return TRUE
end

Thanks ! :)
 
Lua:
function onSay(cid, words, param)
local func = doCreateMonster
if(words:sub(2, 2) == "n") then
func = doCreateNpc
end

local position = getCreaturePosition(cid)
local effect = CONST_ME_MAGIC_RED
if(func(param, position) == LUA_ERROR) then
effect = CONST_ME_POFF
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Creature don't exit.")
end

doSendMagicEffect(position, effect)
return TRUE
end
 
Lua:
function onSay(cid, words, param)
local func = doCreateMonster
if(words:sub(2, 2) == "n") then
func = doCreateNpc
end

local position = getCreaturePosition(cid)
local effect = CONST_ME_MAGIC_RED
if(func(param, position) == LUA_ERROR) then
effect = CONST_ME_POFF
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Creature don't exit.")
end

doSendMagicEffect(position, effect)
return TRUE
end
Still printing error in console
Post automatically merged:

anyone? 🤓
 
Last edited:
I believe that only changes in source would solve.
Lua:
function onSay(cid, words, param, channel)
    local func = doCreateMonster
    if(words:sub(2, 2) == "n") then
        func = doCreateNpc
    end

    local pid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        pid = getPlayerByNameWildcard(t[2])
        if(not pid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local position = getCreaturePosition(pid)
    local effect = CONST_ME_MAGIC_RED
    local ret = func(t[1], position, false, true)
    if(tonumber(ret) == nil) then
        effect = CONST_ME_POFF
        doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
    end

    doSendMagicEffect(position, effect)
    return true
end
 
Lua:
function onSay(cid, words, param, channel)
    local func = doCreateMonster
    if(words:sub(2, 2) == "n") then
        func = doCreateNpc
    end

    local pid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        pid = getPlayerByNameWildcard(t[2])
        if(not pid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local position = getCreaturePosition(pid)
    local effect = CONST_ME_MAGIC_RED
    local ret = func(t[1], position, false, true)
    if(tonumber(ret) == nil) then
        effect = CONST_ME_POFF
        doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
    end

    doSendMagicEffect(position, effect)
    return true
end

it's just written in another way, but it still returns an error. Would have to change in luascript.cpp
 
Lua:
function onSay(cid, words, param, channel)
    local func = doCreateMonster
    if(words:sub(2, 2) == "n") then
        func = doCreateNpc
    end

    local pid = cid
    local t = string.explode(param, ",")
    if(t[2]) then
        pid = getPlayerByNameWildcard(t[2])
        if(not pid) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
            return true
        end
    end

    local position = getCreaturePosition(pid)
    local effect = CONST_ME_MAGIC_RED
    local ret = func(t[1], position, false, true)
    if(tonumber(ret) == nil) then
        effect = CONST_ME_POFF
        doPlayerSendDefaultCancel(cid, (ret == false and RETURNVALUE_NOTPOSSIBLE or RETURNVALUE_NOTENOUGHROOM))
    end

    doSendMagicEffect(position, effect)
    return true
end
kind of work, it doesn't print any error in console when I try to summon creature which not exist but it destroys the function of the script now.
1. monsters are now stacking on me/each other instead of around me when I summon them.
2. cannot summon any npc.
 
Back
Top