Cykotitan
Experienced G'
- Joined
- Nov 4, 2008
- Messages
- 16,892
- Solutions
- 5
- Reaction score
- 858
Could someone explain me how does this function work:
Here's the entire function in LUA:
I've tried using it for different greeting keywords in a NPC script, this way; but it didn't work:
The NPC would ignore word 'charach' and would respond to default greet words (hello, hi, greetings)
Or.. Is there any other way to change the default greet keywords? Maybe by using a callback ;D?
Rep+ for helping me...
PHP:
function FocusModule.messageMatcher(keywords, message)
Here's the entire function in LUA:
PHP:
function FocusModule.messageMatcher(keywords, message)
for i, word in pairs(keywords) do
if(type(word) == 'string') then
if string.find(message, word) and not string.find(message, '[%w+]' .. word) and not string.find(message, word .. '[%w+]') then
return true
end
end
end
return false
end
I've tried using it for different greeting keywords in a NPC script, this way; but it didn't work:
PHP:
FocusModule.messageMatcher(FOCUS_GREETWORDS, "charach")
The NPC would ignore word 'charach' and would respond to default greet words (hello, hi, greetings)
Or.. Is there any other way to change the default greet keywords? Maybe by using a callback ;D?
Rep+ for helping me...