local [COLOR="Blue"][B]place[/B][/COLOR] = { -- This is 'local'
["temple"]={pos = {x=y=z=}
}
[COLOR="Red"]place[/COLOR] = [COLOR="Blue"][I]place[/I][/COLOR][msgcontain(msg)] -- This is 'global', the 'Red' is not the Bold 'Blue' it's like a different statement, but after this 'place = place[msgcontain(msg)]' 'Red' is Bold 'Blue' plus what you have stated in []
if place then
doTeleportThing(cid, place[msgcontain(msg)].pos, false)
end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local places = {
['temple'] = {x=100, y=100, z=7},
}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
for keyword, pos in pairs(places) do
if msgcontains(msg, keyword) then
return doTeleportThing(cid, pos)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local places = { ['temple'] = {x=100, y=100, z=7}[B][COLOR="Red"],[/COLOR][/B] } function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function creatureSayCallback(cid, type, msg) if(not npcHandler:isFocused(cid)) then return false end for keyword, pos in pairs(places) do if msgcontains(msg, keyword) then return doTeleportThing(cid, pos) end end return true end npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())