Code:
[17/12/2009 17:11:34] Lua Script Error: [Npc interface]
[17/12/2009 17:11:34] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:11:34] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:11:34] stack traceback:
[17/12/2009 17:11:34] [C]: in function 'gsub'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[17/12/2009 17:11:34] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:11:34] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
[17/12/2009 17:11:38] Lua Script Error: [Npc interface]
[17/12/2009 17:11:38] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:11:38] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:11:38] stack traceback:
[17/12/2009 17:11:38] [C]: in function 'gsub'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/keywordhandler.lua:128: in function 'processMessage'
[17/12/2009 17:11:38] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:11:38] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
[17/12/2009 17:11:52] Lua Script Error: [Npc interface]
[17/12/2009 17:11:52] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:11:52] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:11:52] stack traceback:
[17/12/2009 17:11:52] [C]: in function 'gsub'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[17/12/2009 17:11:52] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:11:52] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
[17/12/2009 17:11:53] Spy has logged in.
[17/12/2009 17:11:57] Lua Script Error: [Npc interface]
[17/12/2009 17:11:57] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:11:57] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:11:57] stack traceback:
[17/12/2009 17:11:57] [C]: in function 'gsub'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/keywordhandler.lua:128: in function 'processMessage'
[17/12/2009 17:11:57] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:11:57] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
[17/12/2009 17:11:59] Lua Script Error: [Npc interface]
[17/12/2009 17:11:59] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:11:59] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:11:59] stack traceback:
[17/12/2009 17:11:59] [C]: in function 'gsub'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[17/12/2009 17:11:59] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:11:59] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
[17/12/2009 17:12:06] Max Poy has logged out.
[17/12/2009 17:12:11] Lua Script Error: [Npc interface]
[17/12/2009 17:12:11] data/npc/scripts/TP/boat_libertybay.lua:onCreatureSay
[17/12/2009 17:12:11] data/npc/lib/npcsystem/npchandler.lua:301: bad argument #1 to 'gsub' (string expected, got nil)
[17/12/2009 17:12:11] stack traceback:
[17/12/2009 17:12:11] [C]: in function 'gsub'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/npchandler.lua:301: in function 'parseMessage'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/modules.lua:55: in function 'callback'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[17/12/2009 17:12:11] data/npc/lib/npcsystem/npchandler.lua:380: in function 'onCreatureSay'
[17/12/2009 17:12:11] data/npc/scripts/TP/boat_libertybay.lua:10: in function <data/npc/scripts/TP/boat_libertybay.lua:10>
Here is my boat_libertybay.lua
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function GoromaShipwreck(cid, message, keywords, parameters, node)
local npcHandler = parameters.npcHandler
if(npcHandler == nil) then
error('StdModule.travel called without any npcHandler instance.')
end
if(not npcHandler:isFocused(cid)) then
return false
end
if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or parameters.premium == false) then
if(parameters.level ~= nil and getPlayerLevel(cid) < parameters.level) then
npcHandler:say('You must reach level ' .. parameters.level .. ' before I can let you go there.', cid)
elseif(doPlayerRemoveMoney(cid, parameters.cost) ~= TRUE) then
npcHandler:say('You do not have enough money!', cid)
else
if parameters.msg ~= nil then
npcHandler:say(parameters.msg, cid)
end
npcHandler:releaseFocus(cid)
doTeleportThing(cid, parameters.destination, 0)
doSendMagicEffect(parameters.destination, 10)
end
else
npcHandler:say('I can only allow premium players to travel with me.', cid)
end
npcHandler:resetNpc()
return true
end
-- Don't forget npcHandler = npcHandler in the parameters. It is required for all StdModule functions!
local travelNode = keywordHandler:addKeyword({'thais'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Thais for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.say, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32310, y=32210, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'Yalahar'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wanna go to Yalahar,are you sure ?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = false, level = 0, cost = 0, destination = {x=615, y=672, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Next time maybe.'})
local travelNode = keywordHandler:addKeyword({'goroma'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Goroma for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=31993, y=32564, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'port hope'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Port Hope for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32527, y=32784, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'venore'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Venore for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=32952, y=32022, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'darashia'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Darashia for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=33289, y=32480, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
local travelNode = keywordHandler:addKeyword({'ankrahmun'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to sail to Ankrahmun for 0 gold coins?'})
travelNode:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, level = 0, cost = 0, destination = {x=33092, y=32883, z=6} })
travelNode:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Then stay here!'})
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to Thais, Venore, Ankrahmun, Darashia, Goroma and Meriana.'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I am the captain of this ship.'})
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can only offer you a trip to Thais, Venore, Ankrahmun, Darashia, Goroma and Meriana.'})
-- Makes sure the npc reacts when you say hi, bye etc.
npcHandler:addModule(FocusModule:new())