• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua ERROR: Unexpected symbol near ''. What is it?

MUTANO

New Member
Joined
Jan 10, 2009
Messages
39
Reaction score
2
Location
Brazil - Santa Catarina
Hello :D
I made a quest using 2 NPCs, but they have not worked as I wanted.
The two are giving the following error:
imagem2.jpg


SCRIPTS:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local msgs = {
"Hi, |PLAYERNAME|. Better that has disturbed me for good reason, because I'm thirsty for blood.",
"The book that old witch? It may take, we can not understand a written as old,"
"I do not know what book is talking about. Get out of my way now!",
"Are you crazy? I already gave you the damn book!"
"I can not give you something that does not hold charge!"
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, "book of magic") then
if getPlayerStorageValue(cid,8569) == 1 then
if getPlayerFreeCap(cid) < getItemWeight(6120,1) then
selfSay(msgs[5], cid)
else
selfSay(msgs[2], cid)
doPlayerAddItem(cid, 6120, 1)
setPlayerStorageValue(cid, 8569, 2)
end
elseif getPlayerStorageValue(cid, 8569) >= 2 then
selfSay(msgs[4], cid)
else
SelfSay(msgs[3], cid)
end
end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())
----------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local msgs = {
"Hello, |PLAYERNAME|! I am the most powerful witch in the region. But I do not have time for you, I'm busy!",
"My book magic? Vampires of venore robbed me! But I'm already planning a way to take it back those worms."
"I see that my book recovered magic! Take this gift as a bonus. Obrigada .. Hmm..|PLAYERNAME|. This is your name, right?"
"Thank you for having recovered my book!",
"He said he became my book, but where is he? You are trying to rob me? Get out of my way!",
"It seems that this man is too heavy for you."
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, 'book of magic') then

if getPlayerStorageValue(cid, 8569) == -1 then
selfSay(msgs[2], cid)
setPlayerStorageValue(cid,8569, 1)
elseif getPlayerStorageValue(cid, 8569) == 3 then
selfSay(msgs[4],cid)
elseif getPlayerStorageValue(cid, 8569) == 2 then
if getPlayerItemCount(cid, 6120) then
if getPlayerFreeCap + getItemWeight(6120, 1) >= getItemWheight(2487,1) then
selfSay(msgs[3], cid)
doPlayerRemoveItem(cid, 6120, 1)
doPlayerAddItem(uid, 2487, 1)
setPlayerStorageValue(cid, 8569, 3)
else
selfSay(msgs[6], cid)
end
else
selfSay(msgs[5], cid)
end
end

end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())

The two NPCs interact is the same quest, as you can understand. But this error happens ...
I thought that someone what is wrong in 2 Scripts. :huh:
Thanks to attention. Until more.
 
Last edited:
Here you go:

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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

local msgs = {
"Hi, |PLAYERNAME|. Better that has disturbed me for good reason, because I'm thirsty for blood.",
"The book that old witch? It may take, we can not understand a written as old,"
"I do not know what book is talking about. Get out of my way now!",
"Are you crazy? I already gave you the damn book!",
"I can not give you something that does not hold charge!"
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, "book of magic") then
if getPlayerStorageValue(cid,8569) == 1 then
if getPlayerFreeCap(cid) < getItemWeight(6120,1) then
selfSay(msgs[5], cid)
else
selfSay(msgs[2], cid)
doPlayerAddItem(cid, 6120, 1)
setPlayerStorageValue(cid, 8569, 2)
end
elseif getPlayerStorageValue(cid, 8569) >= 2 then
selfSay(msgs[4], cid)
else
SelfSay(msgs[3], cid)
end
end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())

-----------------

PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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

local msgs = {
"Hello, |PLAYERNAME|! I am the most powerful witch in the region. But I do not have time for you, I'm busy!",
"My book magic? Vampires of venore robbed me! But I'm already planning a way to take it back those worms.",
"I see that my book recovered magic! Take this gift as a bonus. Obrigada .. Hmm..|PLAYERNAME|. This is your name, right?",
"Thank you for having recovered my book!",
"He said he became my book, but where is he? You are trying to rob me? Get out of my way!",
"It seems that this man is too heavy for you."
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, 'book of magic') then

if getPlayerStorageValue(cid, 8569) == -1 then
selfSay(msgs[2], cid)
setPlayerStorageValue(cid,8569, 1)
elseif getPlayerStorageValue(cid, 8569) == 3 then
selfSay(msgs[4],cid)
elseif getPlayerStorageValue(cid, 8569) == 2 then
if getPlayerItemCount(cid, 6120) then
if getPlayerFreeCap + getItemWeight(6120, 1) >= getItemWheight(2487,1) then
selfSay(msgs[3], cid)
doPlayerRemoveItem(cid, 6120, 1)
doPlayerAddItem(uid, 2487, 1)
setPlayerStorageValue(cid, 8569, 3)
else
selfSay(msgs[6], cid)
end
else
selfSay(msgs[5], cid)
end
end

end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())

Rep++++++++++++ ME

PD: Next time try using PHP code or taking away emoticons :D
 
@Pitufo;

BUGGGGGGGGGGGGG:
Code:
"The book that old witch? It may take, we can not understand a written as old,"

:(:(:(:confused::(:(:(
 
@All:

The scripts were well:
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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

local msgs = {
"Hello, |PLAYERNAME|! I am the most powerful witch in the region. But I do not have time for you, I'm busy!",
"My book magic? Vampires of venore robbed me! But I'm already planning a way to take it back those worms.",
"I see that my book recovered magic! Take this gift as a bonus. Obrigada .. Hmm..|PLAYERNAME|. This is your name, right?",
"Thank you for having recovered my book!",
"He said he became my book, but where is he? You are trying to rob me? Get out of my way!",
"It seems that this man is too heavy for you."
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, 'book of magic') then

if getPlayerStorageValue(cid, 8569) == -1 then
selfSay(msgs[2], cid)
setPlayerStorageValue(cid,8569, 1)
elseif getPlayerStorageValue(cid, 8569) == 3 then
selfSay(msgs[4],cid)
elseif getPlayerStorageValue(cid, 8569) == 2 then
if getPlayerItemCount(cid, 6120) then
if getPlayerFreeCap + getItemWeight(6120, 1) >= getItemWheight(2487,1) then
selfSay(msgs[3], cid)
doPlayerRemoveItem(cid, 6120, 1)
doPlayerAddItem(uid, 2487, 1)
setPlayerStorageValue(cid, 8569, 3)
else
selfSay(msgs[6], cid)
end
else
selfSay(msgs[5], cid)
end
end

end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())
--------------------
PHP:
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)


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

local msgs = {
"Hi, |PLAYERNAME|. Better that has disturbed me for good reason, because I'm thirsty for blood.",
"The book that old witch? It may take, we can not understand a written as old.",
"I do not know what book is talking about. Get out of my way now!",
"Are you crazy? I already gave you the damn book!",
"I can not give you something that does not hold charge!"
}

npcHandler:setMessage(MESSAGE_GREET, msgs[1])

if msgcontains(msg, "book of magic") then
if getPlayerStorageValue(cid,8569) == 1 then
if getPlayerFreeCap(cid) < getItemWeight(6120,1) then
selfSay(msgs[5], cid)
else
selfSay(msgs[2], cid)
doPlayerAddItem(cid, 6120, 1)
setPlayerStorageValue(cid, 8569, 2)
end
elseif getPlayerStorageValue(cid, 8569) >= 2 then
selfSay(msgs[4], cid)
else
SelfSay(msgs[3], cid)
end
end
talkState[talkUser] = 0

npcHandler:addModule(FocusModule:new())
But the error still persists, and is the same mistake as before.
:eek:
I add REP for you (or for those who come to consult) after the concert that.
 
Last edited:
Back
Top