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

msg = msg:lower() what is problem

Mauzim

Member
Joined
Jan 3, 2011
Messages
568
Reaction score
9
Hello i use otx 2.9 npc lib and there i have problem in npc.lua
i wanna change all msg to msg:lower in msgcontains
i have

function msgcontains(message, keyword)
local message, keyword = message:lower(), keyword:lower()
local msg = msg:lower()
if message == keyword then
return true
end

return message:find(keyword) and not message:find('(%w+)' .. keyword)
end
and deleted msgcontains = doMessageCheck

function in npc.lua but after reload it npc still reply just to small letters if i delete msgcontains function full too reply only to small letters where can be solution of this because i try find msgcontains everywhere in source too. help me please
 
msgcontains should already ignore case.
Check if you have multiple definitions of the function, with Sublime 2 you can just search your whole data folder (Ctrl + Shift + F, enter "msgcontains" and enter the folder path)
 
Credits to @Cykotitan

Code:
function msgcontains(txt, str)
    return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end

function msgcontains(message, keyword, dollar)
    local message, keyword = message:lower(), keyword:lower()
    if(type(keyword) == "table") then return table.isStrIn(message, keyword) end
    return message:find(keyword) and not message:find('(%w+)' .. keyword) and (not dollar or not message:find(keyword .. '(%w+)'))
end
 
Back
Top