Zinc
New Member
[18/07/2008 12:27:40] Lua Script Error: [Npc interface]
[18/07/2008 12:27:40] data/npc/scripts/runes.luanCreatureSay
[18/07/2008 12:14:48] data/npc/scripts/runes.lua:28: bad argument #2 to 'error' (number expected, got string)
[18/07/2008 12:14:48] stack traceback:
[18/07/2008 12:14:48] [C]: in function 'error'
[18/07/2008 12:14:48] data/npc/scripts/runes.lua:28: in function 'callback'
[18/07/2008 12:14:48] data/npc/lib/npcsystem/keywordhandler.lua:40: in function 'processMessage'
[18/07/2008 12:14:48] data/npc/lib/npcsystem/keywordhandler.lua:168: in function 'processNodeMessage'
[18/07/2008 12:14:48] data/npc/lib/npcsystem/keywordhandler.lua:122: in function 'processMessage'
[18/07/2008 12:14:48] data/npc/lib/npcsystem/npchandler.lua:265: in function 'onCreatureSay'
[18/07/2008 12:14:48] data/npc/scripts/runes.lua:10: in function <data/npc/scripts/runes.lua:10>
happens when i sell a vial or flask back to the npc.
the money is given and the npc takes the fask(s)
i posted the same thing onto the TFS server bug area..but elf told me it was my script error :S
the rune.lua script is here:
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 returnVials(cid, message, keywords, parameters, node)
if(npcHandler.focus ~= cid) then
return false
end
local amount = removePlayerItemsWithCharges(cid, parameters.itemid, parameters.charges)
if(amount <= 0) then
npcHandler:say('You do not have any.')
else
local price = amount*parameters.cost
if(doPlayerAddMoney(cid, price) == LUA_NO_ERROR) then
npcHandler:say('Here are your reward of ' .. price .. ' gold coins. It was a pleasure doing business with you.')
else
error('[Error] returnVials:', 'Could not give ' .. price .. ' gold coins to player ' .. getPlayerName(cid))
end
end
npcHandler:resetNpc()
return true
end
local shopModule = ShopModule:new()
npcHandler:addModule(shopModule)
shopModule:addBuyableItem({'snakebite rod', 'SBR'}, 2182, 100, 1, 'snakebite rod')
shopModule:addBuyableItem({'moonlight rod', 'MLR'}, 2186, 400, 1, 'moonlight rod')
shopModule:addBuyableItem({'necrotic rod', 'NR'}, 2185, 700, 1, 'necrotic rod')
shopModule:addBuyableItem({'terra rod', 'TR'}, 2181, 1000, 1, 'terra rod')
shopModule:addBuyableItem({'hailstorm rod', 'HSR'}, 2183, 1200, 1, 'hailstorm rod')
shopModule:addBuyableItem({'wand of vortex', 'WOV'}, 2180, 100, 1, 'wand of vortex')
shopModule:addBuyableItem({'wand of dragonbreath', 'WODB'}, 2191, 400, 1, 'wand of dragonbreath')
shopModule:addBuyableItem({'wand of decay', 'WOD'}, 2188, 700, 1, 'wand of decay')
shopModule:addBuyableItem({'wand of cosmic energy', 'WOE'}, 2189, 1000, 1, 'wand of cosmic energy')
shopModule:addBuyableItem({'wand of inferno', 'WOI'}, 2187, 1200, 1, 'wand of inferno')
shopModule:addBuyableItem({'great health potion', 'ghp'}, 7591, 250, 1, 'great health potion')
shopModule:addBuyableItem({'strong health potion', 'shp'}, 7588, 110, 1, 'strong health potion')
shopModule:addBuyableItem({'health potion', 'hp'}, 7618, 50, 1, 'health potion')
shopModule:addBuyableItem({'great mana potion', 'gmp'}, 7590, 120, 1, 'great mana potion')
shopModule:addBuyableItem({'strong mana potion', 'smp'}, 7589, 80, 1, 'strong mana potion')
shopModule:addBuyableItem({'mana potion', 'mp'}, 7620, 50, 1, 'mana potion')
shopModule:addBuyableItem({'light wand', 'lightwand'}, 2163, 500, 1, 'magic light wand')
shopModule:addBuyableItem({'mana fluid', 'manafluid'}, 2006, 100, 7, 'mana fluid')
shopModule:addBuyableItem({'life fluid', 'lifefluid'}, 2006, 80, 10, 'life fluid')
shopModule:addBuyableItem({'heavy magic missile', 'hmm'}, 2311, 125, 10, 'heavy magic missile rune')
shopModule:addBuyableItem({'great fireball', 'gfb'}, 2304, 180, 4, 'great fireball rune')
shopModule:addBuyableItem({'explo', 'xpl'}, 2313, 250, 6, 'explosion rune')
shopModule:addBuyableItem({'ultimate healing', 'uh'}, 2273, 175, 15, 'ultimate healing rune')
shopModule:addBuyableItem({'sudden death', 'sd'}, 2268, 325, 12, 'sudden death rune')
shopModule:addBuyableItem({'blank', 'rune'}, 2260, 10, 1, 'blank rune')
local node = keywordHandler:addKeyword({'vial'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you wish to return all your empty vials for 5 gold coins each?'})
node:addChildKeyword({'yes'}, returnVials, {itemid = 2006, charges = 0, cost = 5})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, reset = true, text = 'Allright then.'})
npcHandler:addModule(FocusModule:new())
any idea??