Could someone see what's wrong?
I was editing the things,and I'm not a pro Still learning:
Giving rep
I was editing the things,and I'm not a pro Still learning:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
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)
local n
if not npcHandler:isFocused(cid) then
if msgcontains(msg, 'hello') or msgcontains(msg, 'hi') then
npcHandler:say('G...greetings.', cid)
npcHandler:addFocus(cid)
else
return false
end
elseif msgcontains(msg, 'bye') or msgcontains(msg, 'farewell') then
npcHandler:say('Exactly! Get away!', cid)
npcHandler:releaseFocus(cid)
elseif msgcontains(msg, 'book') and getPlayerPartner(cid) > 0 then
npcHandler:say('So, it\'s probably the Ralk\'s book, isn\'t it?', cid)
n = 1
elseif Topic[cid] == 1 and msgcontains(msg, 'yes') then
npcHandler:say('So, true, I can read it for you, but not for free. Interested in it?', cid)
n = 2
elseif Topic[cid] == 2 and msgcontains(msg, 'yes') then
npcHandler:say('Okey then, but are you sure? I will have to take the book then..the reading will destroy it, proceed?', cid)
n = 3
elseif Topic[cid] == 3 and msgcontains(msg, 'yes') then
npcHandler:say('So, it will cost you about 20 gold ingots, are you interested? Not cheap, but it\'s a hard job.', cid)
n = 4
elseif Topic[cid] == 4 and msgcontains(msg, 'yes') then
if doPlayerRemoveMoney(cid, 20000000) then
if doPlayerRemoveItem(cid, 6124, 1) then
npcHandler:say('So, let me see..mm..mmahm.... Now, It says about a wizard called Ralk, that hes defending the Merge realm. This could be a joke too, Says it\'s below the Dream Realm. That\'s all, the other pages are rotten, hope it helped you a little..', cid)
npcHandler:say('Damn, I bet <hicks> your cheating spouse took all of your money <hicks> from you. You\'re as poor as a church mouse. <hicks>', cid)
end
end
return true
end
npcHandler:setMessage(MESSAGE_FAREWELL, "Bye ...")
npcHandler:setMessage(MESSAGE_WALKAWAY, "Bye ...took bad for you..")
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Code:
[27/03/2013 11:22:05] [Error - LuaScriptInterface::loadFile] data/npc/scripts/book.lua:48: 'end' expected (to close 'function' at line 12) near '<eof>'
[27/03/2013 11:22:05] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/book.lua
[27/03/2013 11:22:05] data/npc/scripts/book.lua:48: 'end' expected (to close 'function' at line 12) near '<eof>'