Hiya im running this quiz script >>
-- Phrase-O-Rama
-- By Chaggydawg
-- Version 0.3x Mod by ruler
--
--
Bot = "DVD_Quiz"
phraselists = {
"comedy movies",
"disaster movies",
"famous actors",
"famous actress",
"horror movies",
"top 100 movies",
"Carry on Films",
"western movies",
"Romance Movies",
"Thriller Movies",
"science-fiction movies",
"Crime - Gangster Films",
"Action Movies",
"War Films",
"Animation Films",
"Nicolas Cage",
"James Bond Films",
"John Travolta",
}
topscores = {}
timer = 5000
answer = ""
remainscore = 0
gameon = "on"
phrasenumbers = {}
startingphrase = 1
function Main()
SendToAll("--=============[ The Script "..Bot.." Have Been Restarted! ]=============--")
SetTimer(timer)
doreadscores()
doreadphrases()
donewphrase()
if gameon == "on" then StartTimer() end
end
function ChatArrival(curUser, Data)
s,e,cmd = string.find(Data,"%b<>%s(%S+)")
s,e,scored = string.find(Data,"%b<>%s%S+%s+(%d+)")
s,e,mess = string.find(Data, "%b<>%s+(.*)")
if cmd == "+startgame|" then
dostartgame(curUser)
elseif cmd == "+stopgame|" then
dostopgame(curUser)
elseif cmd == "+scores|" then
displayscores(curUser)
elseif cmd == "+porhelp|" then
dohelp(curUser)
elseif cmd =="+skip|" then
doskipphrase(curUser)
return 1
elseif cmd == "+myscore|" then
domyscore(curUser)
end
---------
if mess ~= nil and answer ~= " " then
mess = string.gsub(mess,"%A","")
ants = string.gsub(answer,"%A","")
if string.find(string.lower(mess),string.lower(ants)) ~= nil then
addtoscore(curUser,remainscore)
answer, startingphrase = donewphrase()
end
end
end
function OnTimer()
doreveal()
end
function donewphrase()
doreadphrases()
answer = phrases[math.random(1,table.getn(phrases))]
startingphrase = 1
remainscore = math.random(2,8)
bigscore = math.random(2,16) if bigscore == 14 then remainscore = 15 end
e,f = string.gsub(answer,"%a","")
timer = 120 / f * 1000
SetTimer(timer)
return answer,startingphrase
end
function doreveal()
if startingphrase == 1 then testing = string.gsub(answer,"%a","?"); startingphrase = 0; SendToAll(Bot,"This Phrase will be worth "..remainscore.." per unrevealed letter plus 5 points for solution. ANYONE CAN PLAY!") SendToAll(Bot, " Avalible Commands are +scores? and? +myscore? and? +porhelp"); end
t,p = string.gsub(testing,"?","")
if p < 2 then
SendToAll(Bot,"The Answer Was: "..answer)
donewphrase()
else
curnumber = burp()
testing = string.sub(testing,1,curnumber-1)..string.sub(answer,curnumber,curnumber)..string.sub(testing,curnumber+1,string.len(testing))
SendToAll(Bot,"[Category: "..phrasename.."]? ?"..testing)
end
end
function burp()
curnumber = math.random(1,string.len(answer))
if string.sub(testing,curnumber,curnumber) ~= "?" then burp() end
return curnumber
end
function dostartgame(curUser)
if gameon == "off" then
gameon = "on"
donewphrase()
StartTimer()
SendToAll(Bot, curUser.sName.." Has Started The Quiz!")
end
end
function dostopgame(curUser)
if gameon == "on" then
gameon = "off"
SendToAll(Bot, curUser.sName.." Has Ended the Quiz :(")
SendToAll(Bot,"The Answer Was: "..answer)
StopTimer()
answer = " "
remainscore = 0
dowritescores()
end
end
function displayscores(curUser)
curUser:SendData(Bot,"-----------------------------------------------")
curUser:SendData(Bot,"Top 10 Quiz Player")
curUser:SendData(Bot,"-----------------------------------------------")
table.sort(topscores, function(a,b) return a[1]>b[1] end)
total = 10
if table.getn(topscores) < total then total = table.getn(topscores) end
for i = 1,total,1 do
curUser:SendData(Bot,"["..i.."] "..topscores[i][2].." - "..topscores[i][1])
end
curUser:SendData(Bot,"-----------------------------------------------")
end
function addtoscore(curUser,remainscore)
dude = table.getn(topscores)+1
oldscore = 0
for i = 1,table.getn(topscores),1 do
if topscores[i][2] == curUser.sName then
dude = i
oldscore = topscores[i][1]
break
end
end
a,b = string.gsub(testing,"?",".")
topscores[dude] = {(b*remainscore)+oldscore+5,curUser.sName}
dowritescores()
table.sort(topscores, function(a,b) return a[1]>b[1] end)
for i = 1,table.getn(topscores),1 do
if topscores[i][2] == curUser.sName then
place = ""
SendToAll(Bot,curUser.sName.." Got It!! The Answer Was: "..answer)
SendToAll(Bot,curUser.sName.." has been awarded "..((b*remainscore)+5).." points!")
if i == 1 then place = "st champ!" end
if i == 2 then place = "nd place" end
if i == 3 then place = "rd place" end
if i == 4 or i == 5 or i == 6 or i == 7 or i == 8 or i == 9 or i == 10 then place = "th place" end
SendToAll(Bot,"[ "..i..place.." ] "..topscores[i][2].." - ".."Total score [ "..topscores[i][1].." ]")
end
end
end
function dowritescores()
local f = io.open ( "por/porscores.txt", "w" )
if f then
local m = "1&"..topscores[1][2].."$"..topscores[1][1]
for i = 2,table.getn(topscores),1 do
m = m.."\n"..(i).."&"..topscores[i][2].."$"..topscores[i][1]
end
f:write(m)
f:close()
end
end
function doreadscores()
A=1
for line in io.lines("por/porscores.txt") do
if line == nil then break end
s,e,rank,unick,score = string.find(line,"(%S+)&(%S+)$(%S+)")
topscores[tonumber(A)] = {tonumber(score),unick}
A = A+1
end
A = nil
end
function doreadphrases()
phrases = {}
phrasename = phraselists[math.random(1,table.getn(phraselists))]
t = 1
for line in io.lines("por/"..string.lower(phrasename)..".txt") do
if line == nil then break end
? ? ? ? ? ? phrases[t] = line
t = t+1
end
end
function dohelp(curUser)
curUser:SendData(Bot, "Quiz Help")
curUser:SendData(Bot, "+scores Displays Top 10 Quiz Scores")
curUser:SendData(Bot, "+myscore Displays your Quiz Rank/Score")
curUser:SendData(Bot, "+porhelp Displays Quiz Help")
if curUser.bOperator then
curUser:SendData(Bot, "+startgame Begins Quiz")
curUser:SendData(Bot, "+stopgame Stops Quiz")
curUser:SendData(Bot, "+skip Skips the Quiz Phrase")
return 1
end
end
function domyscore(curUser)
table.sort(topscores, function(a,b) return a[1]>b[1] end)
for i = 1,table.getn(topscores),1 do
if topscores[i][2] == curUser.sName then
curUser:SendData(Bot,"Rank ["..i.."] "..topscores[i][2].." - "..topscores[i][1])
break
end
end
end
function doskipphrase(curUser)
if curUser.bOperator then
SendToAll(Bot,curUser.sName.." has Skipped this phrase.")
SendToAll(Bot,"No Points Awarded This Round.")
SendToAll(Bot,"The Answer was: "..answer)
donewphrase()
end
end
function OpConnected(user)
user:SendData("$UserCommand 1 2 DVD_Quiz\\Start Quiz$<%[mynick]> +startgame||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Stop Quiz$<%[mynick]> +stopgame||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Skip Question$<%[mynick]> +skip||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Quiz Help$<%[mynick]> +porhelp||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Show Scores$<%[mynick]> +scores||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Show Your Score$<%[mynick]> +myscore||")
end
function NewUserConnected(user)
user:SendData("$UserCommand 1 2 DVD_Quiz\\Quiz Help$<%[mynick]> +porhelp||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Show Scores$<%[mynick]> +scores||")
user:SendData("$UserCommand 1 2 DVD_Quiz\\Show Your Score$<%[mynick]> +myscore||")
end
BUT i get this error? >>? [13:22] Syntax C:\0.3.3.21i.dbg\0.3.3.21i.dbg\scripts\Quiz.lua:77: division by zero
Could some one please correct it then post it again? Would be much appreciated ta ta xx
that better? And hey i didnt remove nout , ruler gave me this script ages ago there aint no author things in it, what ive pasted is what is in the LUA file :P so dont blame me blame ruler :D lol And just to make U happy i stuck the author thing in ok?
And also the 1 you put for download isnt the same, mines been edititd to how i want it, but i just want the error corrected? plzzzzz Cum on mutor be a babe :D
hmm with the game, i edit the phrases, add new catergorys ect , ive just totally converted mine to a DVD 1 :P
Hm i dunno it works fine for a while, then now & again ill look in ptokax and see that error. its probably just me lost me marbles. but i wanted to see if it was the script or if it were me, Im still getting it, and the quiz was just running, theres gotta be an error sum were?
Im also getting this one now >> [21:06] Syntax C:\0.3.3.21i.dbg\0.3.3.21i.dbg\scripts\Quiz.lua:78: division by zero
aswell as this 1 >> [13:22] Syntax C:\0.3.3.21i.dbg\0.3.3.21i.dbg\scripts\Quiz.lua:77: division by zero
for crying out loud!!