Postado Dezembro 17, 2014 10 anos 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 Dezembro 17, 2014 10 anos por Thayam (veja o histórico de edições) "A coisa mais indispensável a um homem é reconhecer o uso que deve fazer do seu próprio conhecimento." Ajudei? Reputar não vai te matar E Ainda me incentiva muito a continuar ajudando a todos! Meus trabalhos: [TUTORIAL] Quando preocupar-se com as cores? - Spriting [TUTORIAL] Pedras e Rochas - Spriting [APOSTILAS] Cores e sua parte Teórica - Spriting [TUTORIAL] Entendendo o Básico sobre cores - Spriting [TUTORIAL] Spriting, por onde começar? [TUTORIAL] Coisas para evitar - Spriting [TUTORIAL] Usando e Escolhendo Cores - Spriting [TUTORIAL] Pensando em Cores - Spriting [TUTORIAL] Adicionando novos Pokémons em seu PDA com e sem Icon System [TUTORIAL] [OLD/OTC] Criando link de Download Direto para seu cliente! Meu Show-off Thayam's Show Off
Postado Dezembro 17, 2014 10 anos 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 Dezembro 17, 2014 10 anos por danihcv (veja o histórico de edições) Te ajudei?? REP + e ficamos quites... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
Postado Dezembro 17, 2014 10 anos 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! "A coisa mais indispensável a um homem é reconhecer o uso que deve fazer do seu próprio conhecimento." Ajudei? Reputar não vai te matar E Ainda me incentiva muito a continuar ajudando a todos! Meus trabalhos: [TUTORIAL] Quando preocupar-se com as cores? - Spriting [TUTORIAL] Pedras e Rochas - Spriting [APOSTILAS] Cores e sua parte Teórica - Spriting [TUTORIAL] Entendendo o Básico sobre cores - Spriting [TUTORIAL] Spriting, por onde começar? [TUTORIAL] Coisas para evitar - Spriting [TUTORIAL] Usando e Escolhendo Cores - Spriting [TUTORIAL] Pensando em Cores - Spriting [TUTORIAL] Adicionando novos Pokémons em seu PDA com e sem Icon System [TUTORIAL] [OLD/OTC] Criando link de Download Direto para seu cliente! Meu Show-off Thayam's Show Off
Postado Dezembro 17, 2014 10 anos Editei o post acima. Confere aí. Te ajudei?? REP + e ficamos quites... http://www.tibiaking.com/forum/uploads/emoticons/default_happyy.png' alt=';D'> Atenciosamente, Daniel. Abraços! Meus tutoriais: Programação: Resolvendo QUALQUER erro na data base. Scripts (system's, creaturescripts, mod's, NPC's, etc): (Sistema) GOD Ambient Light Full. Adicionando novas mounts ao servidor [NPC] Papai Noel que dá presente todo ano. Web-site: Resolvendo problema de caracteres especiais em PHP Formatando textos em PHP! Mudando a cor, tamanho, fonte, etc. Criando e configurando tabelas para paginas PHP
Postado Dezembro 17, 2014 10 anos 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 "A coisa mais indispensável a um homem é reconhecer o uso que deve fazer do seu próprio conhecimento." Ajudei? Reputar não vai te matar E Ainda me incentiva muito a continuar ajudando a todos! Meus trabalhos: [TUTORIAL] Quando preocupar-se com as cores? - Spriting [TUTORIAL] Pedras e Rochas - Spriting [APOSTILAS] Cores e sua parte Teórica - Spriting [TUTORIAL] Entendendo o Básico sobre cores - Spriting [TUTORIAL] Spriting, por onde começar? [TUTORIAL] Coisas para evitar - Spriting [TUTORIAL] Usando e Escolhendo Cores - Spriting [TUTORIAL] Pensando em Cores - Spriting [TUTORIAL] Adicionando novos Pokémons em seu PDA com e sem Icon System [TUTORIAL] [OLD/OTC] Criando link de Download Direto para seu cliente! Meu Show-off Thayam's Show Off
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.