Ir para conteúdo

Featured Replies

Postado

Boa Tarde amigos do TK!

 

Estou tendo um erro com o script a seguir:

local keywordHandler = KeywordHandler:new()


local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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) end
if(not npcHandler:isFocused(cid)) then
return false
end

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
msg = string.lower(msg)
---------
local cfsto = {
stoPr = 91230, -- storage pra ele ir fala com o npc e volta !!
stoCo = 91231, -- storage q ele falou com a npc tudo certo
StoM = 91232, -- sto pra prox missão
stoAdd = 91233, -- sto q o npc de ceru deu pra ele q confirmo a msg
}

local storage = 91250 -- sto da quest completada inteira

-- \/ storages da missão 2
local stoTwo = {
sto1 = 91234, -- storage pra poder fala com ash
sto2 = 91235, -- storage q diz q ele falou com ash
sto3 = 91236, -- storage dada pra ele pode pega o clan no pvp
}

if (msgcontains(msg, 'info') or msgcontains(msg, 'information')) then
if getPlayerStorageValue(cid, storage) >= 1 then
selfSay("I do not need your help anymore.", cid)
return true
end
selfSay("Hello, I'm Bill, I like to know everything about pokemon, I'm needing some help to complete my research over pokemon, want to help me?", cid)
return true end
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then
selfSay("Okay, I need you to send a message to a friend of mine, she is in cerulean, she call me for a great event pokemons of waterborne more as I am very busy with my research of all Pokemon, I can not go, you can go there telling her that I will not go?", cid)
talkState[talkUser] = 2
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'ok')) and talkState[talkUser] == 2 then
selfSay("Ok, I'll be waiting for you here.", cid)
setPlayerStorageValue(cid, cfsto.stoPr, 1)
talkState[talkUser] = 3
elseif (msgcontains(msg, 'talk') or msgcontains(msg, 'complete')) and talkState[talkUser] == 3 then
selfSay("You said what i asked?", cid)
talkSta[talkUser] = 4
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 4 then
if getPlayerStorageValue(cid, cfsto.stoAdd) >= 1 then
selfSay("Sorry, you did not do what I asked you needed.", cid)
return true
end
selfSay("Very good, I am very grateful for helping me with this help I managed to finish my research and can find the formula of gvhd your pokemon stronger, I adptei this as the name of clan, you want to know more about this story?", cid)
setPlayerStorageValue(cid, cfsto.StoM, 1)
talkState[talkUser] = 5
--------------------- 1 * missão /\ -----
--\\--
--- 2 * missão \/ ----
elseif (msgcontains(msg, 'missao') or msgcontains(msg, 'help')) and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, cfsto.stoM) <= 1 then
selfSay("Sorry, you even helped me in the first mission!.", cid)
return true
end
selfSay("I see a lot of interest on their part, need you Fasse me another favor, this interested?", cid)
talkState[talkUser] = 2
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 2 then
selfSay("Ok, I'm already almost done my research officer clans, intão I need you to talk to ash he will speak to the attribute needed to finalize the clan, can you bring me this Feedback from the ash?", cid)
talkState[talkUser] = 3
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 2 then
selfSay("Ok, I hope you do not make me wait too long.", cid)
setPlayerStorageValue(cid, stoTwo.sto1, 1)
talkState[talkUser] = 3
---- \/ entregando a missão
elseif (msgcontains(msg, 'help') or msgcontains(msg, 'help')) and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, stoTwo.sto2) <= 1 then
selfSay("Sorry, you even helped me in the msg mission.", cid)
return true
end
selfSay("Our really good, I believe you are the best, when you are level 80 you can tonarsse a clan! thank you.", cid)
setPlayerStorageValue(cid, storage, 1)

 

Ao executar este script aparece o seguinte erro:

[17/12/2014 16:13:47] [Error - LuaScriptInterface::loadFile] data/npc/scripts/BillScript.lua:41: '<eof>' expected near 'elseif'
[17/12/2014 16:13:47] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/BillScript.lua
[17/12/2014 16:13:47] data/npc/scripts/BillScript.lua:41: '<eof>' expected near 'elseif'

Dúvida 1:

 

O erro mostrado está dizendo que a linha 41 tenho uma função que não está cumprindo as condições da função:

A linha 41 é essa:

elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then

Até ai ok, mas se repararam nesse script, ela realmente não atende condição, se não estou enganado (me corrijam por favor se estiver, não sou experiente com scripts), a condição elseif ocorreria quando eu quero colocar uma condição dentro de outra condição correto?

 

Duvida 2: Se meu raciocínio da dúvida 1 está correto, essa função elseif da linha 41, teria inicio aonde? :X

 

Peço que me ajudem por favor, e se possível me expliquem aonde estou errando no raciocínio :)

 

OBS: O script não é meu, já veio no server, só estou tentando arruma-lo.

 

Rep +++ para todos que me ajudarem, como de costume :)

 

Grande abraço!

Editado por Thayam (veja o histórico de edições)

  • Respostas 9
  • Visualizações 318
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Editei o post acima. Confere aí.

  • Na verdade esse npc ta mt bugado. Me explica, qual a função dele?

  • Entendi. Mas eu não sou muuuito chegado à npc's não... :s Então o que aconteceria: eu teria um trabalho infernal (o que ñ é problema pra mim) mas com uma remota chance de funcionar... :/ Te aconsel

Postado

Cara, eu abri no meu editor, e to vendo que te mega errado.
Vou dar uma lida nele e tentar arrumar. Jaja posto

 

@Edit: Velho. Ta mt cheio cheio de problemas, por exemplo tem varias checagens pro msm conteudo da mensagem do player.

Aconselho vc procurar outro script pra esse npc. Ou então me conta o que era pra esse npc fazer.

 

 

obs: eu "arrumei" o corpo (qro dizer que fechei todos os if's e a função) dele mas com certeza ainda vai dar erro:

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
msg = string.lower(msg)
---------
local cfsto = {
stoPr = 91230, -- storage pra ele ir fala com o npc e volta !!
stoCo = 91231, -- storage q ele falou com a npc tudo certo
StoM = 91232, -- sto pra prox missão
stoAdd = 91233, -- sto q o npc de ceru deu pra ele q confirmo a msg
}

local storage = 91250 -- sto da quest completada inteira

-- \/ storages da missão 2
local stoTwo = {
sto1 = 91234, -- storage pra poder fala com ash
sto2 = 91235, -- storage q diz q ele falou com ash
sto3 = 91236, -- storage dada pra ele pode pega o clan no pvp
}

if (msgcontains(msg, 'info') or msgcontains(msg, 'information')) then
if getPlayerStorageValue(cid, storage) >= 1 then
selfSay("I do not need your help anymore.", cid)
return true
end
selfSay("Hello, I'm Bill, I like to know everything about pokemon, I'm needing some help to complete my research over pokemon, want to help me?", cid)
return true
talkState[talkUser] = 1
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 1 then
selfSay("Okay, I need you to send a message to a friend of mine, she is in cerulean, she call me for a great event pokemons of waterborne more as I am very busy with my research of all Pokemon, I can not go, you can go there telling her that I will not go?", cid)
talkState[talkUser] = 2
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'ok')) and talkState[talkUser] == 2 then
selfSay("Ok, I'll be waiting for you here.", cid)
setPlayerStorageValue(cid, cfsto.stoPr, 1)
talkState[talkUser] = 3
elseif (msgcontains(msg, 'talk') or msgcontains(msg, 'complete')) and talkState[talkUser] == 3 then
selfSay("You said what i asked?", cid)
talkSta[talkUser] = 4
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 4 then
if getPlayerStorageValue(cid, cfsto.stoAdd) >= 1 then
selfSay("Sorry, you did not do what I asked you needed.", cid)
return true
end
selfSay("Very good, I am very grateful for helping me with this help I managed to finish my research and can find the formula of gvhd your pokemon stronger, I adptei this as the name of clan, you want to know more about this story?", cid)
setPlayerStorageValue(cid, cfsto.StoM, 1)
talkState[talkUser] = 5
--------------------- 1 * missão /\ -----
--\\--
--- 2 * missão \/ ----
elseif (msgcontains(msg, 'missao') or msgcontains(msg, 'help')) and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, cfsto.stoM) <= 1 then
selfSay("Sorry, you even helped me in the first mission!.", cid)
return true
end
selfSay("I see a lot of interest on their part, need you Fasse me another favor, this interested?", cid)
talkState[talkUser] = 2
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 2 then
selfSay("Ok, I'm already almost done my research officer clans, intão I need you to talk to ash he will speak to the attribute needed to finalize the clan, can you bring me this Feedback from the ash?", cid)
talkState[talkUser] = 3
elseif (msgcontains(msg, 'yes') or msgcontains(msg, 'sim')) and talkState[talkUser] == 2 then
selfSay("Ok, I hope you do not make me wait too long.", cid)
setPlayerStorageValue(cid, stoTwo.sto1, 1)
talkState[talkUser] = 3
---- \/ entregando a missão
elseif (msgcontains(msg, 'help') or msgcontains(msg, 'help')) and talkState[talkUser] == 1 then
if getPlayerStorageValue(cid, stoTwo.sto2) <= 1 then
selfSay("Sorry, you even helped me in the msg mission.", cid)
return true
end
selfSay("Our really good, I believe you are the best, when you are level 80 you can tonarsse a clan! thank you.", cid)
setPlayerStorageValue(cid, storage, 1)
end
return true
end

Editado por danihcv (veja o histórico de edições)

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
  • Autor

Cara, eu abri no meu editor, e to vendo que te mega errado.

Vou dar uma lida nele e tentar arrumar. Jaja posto

Ok, obrigado pela ajuda, fico no aguardo!

Postado

Editei o post acima. Confere aí.

Te ajudei?? REP + e ficamos quites... <ahttp://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'>

Atenciosamente,

Daniel.

Abraços!

Postado
  • Autor

Editei o post acima. Confere aí.

Realmente ainda mostra alguns erros, segue:

[17/12/2014 17:11:05] [Error - LuaScriptInterface::loadFile] data/npc/scripts/BillScript.lua:40: 'end' expected (to close 'if' at line 33) near 'talkState'
[17/12/2014 17:11:06] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/BillScript.lua
[17/12/2014 17:11:06] data/npc/scripts/BillScript.lua:40: 'end' expected (to close 'if' at line 33) near 'talkState'

Me parece que algum if foi não fechado :s

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo