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

Solved [LATEST - OTHIRE] problem with lines in some NPCS

Felipe93

Ghost Member
Joined
Mar 21, 2015
Messages
1,990
Solutions
9
Reaction score
334
Location
Chile
Hello otland

well im using latest OTHIRE release with legacy-server npcs(which uses or is based on OTHIRE 0.0.3)
it's a console error

the problem is with "titlecase" which is a nil value

here an example of an error with a npc

Code:
Lua Script Error: [Npc interface]
data/npc/scripts/Captain Seagull.lua

data/npc/scripts/Captain Seagull.lua:56: attempt to call global 'titleCase' (a nil value)
Warning: [NpcScript::NpcScript] Can not load script. data/npc/scripts/Captain Seagull.lua

anyone could tell me with which word should i replace "titlecase" to remove this console error

here is part of the lua script that cotains the word that is causing errors on console

Lua:
local function addTravelKeyword(keyword, cost, destination, action)
    local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. titleCase(keyword) .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
        travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = cost, discount = 'postman', destination = destination })
        travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})

@Peonso any idea men?


pls help >.<
 
maby you don't have that function, don't copy paste stuff
it's obvius that the server don't have that function :/ that's why im asking with which function should i replace titlecase
anyway it's pretty weird because legacyserver it's based on othire 0.0.3 and im using othire 1.0
 
try add to your functions.lua or globals

Lua:
function titleCase(str)
    return (str:gsub("^%l", string.upper))
end
 
Solution
try add to your functions.lua or globals

Lua:
function titleCase(str)
    return (str:gsub("^%l", string.upper))
end
yea thanks bro i forgot to update data/lib/functions.lua

thanks for the fatest help

all these codes were missing
Code:
-- custom Legacy Global Storage functions
function getEternalStorageValue(key, parser)
    local valueQuery = db.storeQuery("SELECT `value` FROM `legacy_storage` WHERE `key` = " .. key .. ";")
    if not valueQuery then
        if parser then
            return false
        else
            return -1
        end
    end
    local value = result.getDataInt(valueQuery, "value")
    result.free(valueQuery)
    return tonumber(value) or value
end

function setEternalStorageValue(key, value)
    if getEternalStorageValue(key, true) then
        db.executeQuery("UPDATE `legacy_storage` SET `value` = '" .. value .. "' WHERE `key` = " .. key .. ";")
    else
        db.executeQuery("INSERT INTO `legacy_storage` (`key`, `value`) VALUES (" .. key .. ", " .. value .. ");")
    end
    return true
end

function getPlayerOnlineTime(cid)
    local timeQuery = db.storeQuery("SELECT `onlinetimeall` FROM `znote_players` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
    local onlinetimeall = result.getDataInt(timeQuery, "onlinetimeall")
    result.free(timeQuery)
    return tonumber(onlinetimeall) or onlinetimeall
end

function getCreateDate(cid)
    local createdQuery = db.storeQuery("SELECT `created` FROM `znote_players` WHERE `player_id` = " .. getPlayerGUID(cid) .. ";")
    local created = result.getDataInt(createdQuery, "created")
    result.free(createdQuery)
    return tonumber(created) or created
end

function titleCase(str)
    return (str:gsub("^%l", string.upper))
end
 
Back
Top