-- Questionário -- Escrito por Ninguem nome="Questionário do None" -- nome para aparecer no topo questao={ -- 'p' recebe a pergunta, 'r' recebe um conjunto de respostas a serem consideradas corretas. O script aceita quantas você quiser colocar. {p="Isso é uma pergunta?",r={"sim", "s"}}, {p="Quantos meses tem 30 dias?",r={"5", "cinco"}}, {p="Escreva seu nome",r={"seu nome"}}, {p="1, 3, 7, 15, 31, ?",r={"63"}}, {p="Mãe de maria tem cinco filhas: Lalá, Lelé, Lilí, Loló e a...?",r={"maria"}}, {p="Você é o Pelé?",r={"n", "não", "naum", "ñ"}}, {p="Qual a metade de dois mais dois?",r={"3", "três", "tres"}}, {p="É um país da Europa...",r={"espanha", "itália", "holanda", "errou"}}, {p="Uma palavra com CINCO letras que foi resposta de uma das questões.",r={"cinco"}}, {p="Vai responder 'não'?",r={"jamais", "nunca"}}, } mapa=[[

]] npag=15 jogador={} for i, v in pairs(tfm.get.room.playerList) do jogador[i] = {p={}, pag=1} for j, v in pairs(questao) do jogador[i].p[j] = "Responder" end end function eventNewPlayer(p) if jogador[p] == nil then jogador[p] = {p={}, pag=1} for j, v in pairs(questao) do jogador[p].p[j] = "Responder" end end escreve(p) verifica(p, false) end function correto(r, n) for i, v in pairs(questao[n].r) do if string.upper(r) == string.upper(v) then return true end end return false end function win(p, ganha) ui.addTextArea(2, "", p, 5, 25, 790, 375, 0x324650, 0x324650, 0.8, true) ui.addTextArea(3, "

Você terminou!", p, 0, 180, 800, 375, 0, 0, 0, true) if ganha then print("" .. p .. " terminou.") tfm.exec.respawnPlayer(p) tfm.exec.giveCheese(p) tfm.exec.playerVictory(p) end end function escreve(p) local txt = "" for i=1+(jogador[p].pag-1)*npag, #questao do if i > jogador[p].pag*npag then break end txt = txt .. "" .. i .. ") " if questao[i].p:len() > 50 then txt = txt .. questao[i].p:sub(1,47) .. "..." else txt = txt .. questao[i].p end if correto(jogador[p].p[i], i) then txt = txt .. " | " else txt = txt .. " | " end if jogador[p].p[i]:len() > 30 then txt = txt .. jogador[p].p[i]:sub(1,27) .. "..." else txt = txt .. jogador[p].p[i] end txt = txt .. "\n" end ui.addTextArea(0, txt, p, 10, 30, 780, 330, 0x364852, 0x465862, 1, true) ui.addTextArea(10,"

«« " .. jogador[p].pag .. " de " .. math.floor(#questao/npag)+1 .. " »»\n", p, 5, 365, 790, 100, 0, 0, 0, true) end function verifica(p, ganha) local pts = 0 for i=1, #questao do if correto(jogador[p].p[i], i) then pts = pts + 1 end end tfm.exec.setPlayerScore(p, pts, false) if pts >= #questao then win(p, ganha) end end function eventPopupAnswer(id, p, r) ui.removeTextArea(1, p) if r ~= "" then jogador[p].p[id] = r end escreve(p) verifica(p, true) end function mudaPag(p, n) if (jogador[p].pag == 1 and n == "ant") or (jogador[p].pag == math.floor(#questao/npag)+1 and n == "prox") then return false end if n == "ant" then jogador[p].pag = jogador[p].pag - 1 else jogador[p].pag = jogador[p].pag + 1 end escreve(p) end function eventNewGame() tfm.exec.setUIMapName("

" .. nome .. "

\n") end function eventTextAreaCallback(id, p, n) if n == "ant" or n == "prox" then mudaPag(p, n) else ui.addTextArea(1, "", p, 5, 25, 790, 375, 0x324650, 0x324650, 0.8, true) ui.addPopup(tonumber(n,10), 2, "" .. questao[tonumber(n,10)].p, p, 250, 180, 300, true) end end fim = false tfm.exec.disableAutoTimeLeft(true) tfm.exec.disableAutoShaman(true) tfm.exec.disableAutoScore(true) tfm.exec.disableAutoNewGame(true) tfm.exec.newGame(mapa) for i, v in pairs(tfm.get.room.playerList) do tfm.exec.setPlayerScore(i, 0, false) escreve(i) end