iv got a question and was wondering if it would be possible to put an auto stop in the trivia i.e after 10 questions and no one answers the trivia questions it will auto stop as iv found that some people start the trivia and dont stop the trivia and leave the trivia running when they leave the room the code is below and im not good enough to alter a code like this
I also know im asking a lot and maybe its too much to take on so I will understand .... as always nais tuke for any comments on this one ![]()
forgot the trivia is for SPCN Chat.
;Replace the font here to change the font used by the trivia script, but Tahoma is the best one for
;displaying all the chatters nicknames correctly.
on *:TEXT:*:*:{
if (%trivia.status.bot == 0) { return }
if (!hof isin $1) { msg %trivia.channel $font $msg.trivia.hof $+ }
if (!row isin $1) { notice $nick $msg.trivia.record.row }
if (!fast isin $1) { notice $nick $msg.trivia.record.time }
if (!records isin $1) { notice $nick $msg.trivia.records }
if (!wins isin $1) { notice $nick $msg.trivia.wins }
if (!champ isin $1) { notice $nick $msg.trivia.champs }
if (!rank isin $1) { notice $nick $msg.trivia.rank }
if (!version isin $1) { notice $nick $msg.trivia.version }
if (!add isin $1) { notice $nick $msg.trivia.thanks | write %trivia.additions $nick $2- }
if (!report isin $1) { notice $nick $msg.trivia.thanks | write %trivia.report $nick $2- }
if ($chan != %trivia.channel) { return }
if (!helptrivia isin $1) { givehelp }
if ($nick isop $chan) || (%trivia.status.oponly == 0) {
if (!trivia isin $1) { $trivia($2) }
if (!giveup isin $1) { $trivg }
if (%trivia.status.cur == 0) { return }
if (!strivia isin $1) { if ((%trivia.teammode == 0) || ($isop($nick))) { strivia } }
}
if (%trivia.status.cur == 0) { return }
if (!join isin $1) && (%trivia.teammode == 1) { $setteam($nick, $2) }
if (%trivq.question == $null) { return }
if (!hint isin $1) && ($question.time >= %trivia.lag.hintallow) { msg %trivia.channel $font $msg.question.hint $+ }
if (!!hint isin $1) && ($question.time >= %trivia.lag.hintallow) { msg %trivia.channel $font $msg.question.hint2 $+ }
if (!vowels isin $1) && ($question.time >= %trivia.lag.hintallow) { msg %trivia.channel $font $msg.question.vowels $+ }
if (!bighint isin $1) && ($question.time >= %trivia.lag.hintallow) { msg %trivia.channel $font $msg.question.bighint $+ }
if (!repeat isin $1) { notice $nick $msg.question.current }
var %i = 2
while (%i <= $tokq) {
if ( (($fix($tok(%i)) isin $fix($1-) ) && ( $len( $1- ) <= $calc(3 * $len( $tok(%i) )) ) )) { answered }
inc %i
}
}
dialog options {
title "Trivia Settings"
size -1 -1 182 133
option dbu
tab "General", 1, 0 -2 181 133
box "General Settings", 10, 2 13 177 101, tab 1
text "Room", 40, 6 22 30 8, tab 1
text "Questions", 50, 6 34 30 8, tab 1
text "Additions", 60, 6 46 30 8, tab 1
text "Report", 70, 6 58 30 8, tab 1
text "Delimiter", 80, 6 70 30 8, tab 1
text "Directory", 90, 6 81 30 8, tab 1
edit [ %trivia.channel ], 45, 35 21 140 10, tab 1 autohs
edit [ %trivia.questions ], 55, 35 33 140 10, tab 1 autohs
edit [ %trivia.additions ], 65, 35 45 75 10, tab 1 autohs
edit [ %trivia.report ], 75, 35 57 75 10, tab 1 autohs
edit [ %trivia.delimiter ], 85, 35 69 75 10, tab 1 autohs
edit [ %trivia.dir ], 95, 35 81 140 10, tab 1 autohs
text "!hint = Standard Hint", 13, 6 92 67 8, tab 1
text "!!hint = Bigger Hint", 15, 6 102 67 8, tab 1
text "!vowels = Vowels", 16, 98 92 58 8, tab 1
text "Modified for Hybrid", 33, 5 119 52 8, disable tab 1
text "!helptrivia = Commands", 34, 99 101 77 8, tab 1
tab "Defaults", 2
box "Time Settings in seconds:", 12, 2 51 114 63, tab 2
text "Before Start", 130, 5 59 37 7, tab 2
text "Between Questions (answered)", 140, 5 68 78 7, tab 2
text "Given to Answer", 150, 5 76 43 8, tab 2
text "Before Auto-Hint", 160, 5 85 47 7, tab 2
text "Between Question (timed-out)", 170, 5 93 77 7, tab 2
text "Before '!hint' allowed", 181, 5 101 54 7, tab 2
edit [ %trivia.lag.start ], 135, 96 58 16 9, tab 2
edit [ %trivia.lag.answered ], 145, 96 67 16 9, tab 2
edit [ %trivia.lag.timedout ], 155, 96 75 16 9, tab 2
edit [ %trivia.lag.hint ], 165, 96 84 16 9, tab 2
edit [ %trivia.lag.timed ], 175, 96 93 16 9, tab 2
edit [ %trivia.lag.hintallow ], 186, 96 102 16 9, tab 2
box "Question Settings", 14, 2 13 59 37, tab 2
text "Default Round", 200, 4 22 38 7, tab 2
text "Champ Goal", 210, 4 35 34 7, tab 2
edit [ %trivia.default ], 205, 40 21 19 10, tab 2 limit 4
edit [ %trivia.reset ], 215, 40 34 19 10, tab 2 limit 4
check "Auto-Hint", 225, 66 37 47 9, tab 2 left
check "Champ Mode", 235, 66 29 47 9, tab 2 left
check "On/Off Op-Only", 245, 66 21 47 9, tab 2 left
box "Modes", 6, 62 13 54 37, tab 2
box "Commands:", 35, 117 13 63 101, tab 2
text "!hof: Hall of Fame.", 36, 119 20 59 7, tab 2
text "!row: Streak record.", 37, 119 26 59 7, tab 2
text "!fast: Fast nick", 38, 119 32 59 7, tab 2
text "!records: All 3 records.", 39, 119 38 59 7, tab 2
text "!wins: Most wins.", 41, 119 44 59 7, tab 2
text "!champ: Current champ.", 42, 119 50 59 7, tab 2
text "!rank: Your rank.", 43, 119 56 59 7, tab 2
text "!version: Trivia version.", 44, 119 62 59 7, tab 2
text "!add: Add a question.", 46, 119 68 59 7, tab 2
text "!report: Report error.", 47, 119 74 59 7, tab 2
text "!helptrivia: Help.", 48, 119 80 59 7, tab 2
text "!trivia: Begin trivia.", 49, 119 86 59 7, tab 2
text "!strivia: Stop trivia.", 51, 119 92 59 7, tab 2
text "!join: Join a team.", 52, 119 98 60 7, tab 2
text "!repeat: Repeats ?.", 53, 119 104 60 7, tab 2
tab "Teams", 3
text "Team 1 name", 180, 5 22 23 7, tab 3
text "Team 2 name", 190, 5 38 24 7, tab 3
edit [ %trivia.team.1 ], 185, 29 21 90 10, tab 3 autohs
edit [ %trivia.team.2 ], 195, 29 37 90 10, tab 3 autohs
text "Tied Message", 300, 5 62 36 7, tab 3
text "Team 1 Wins", 310, 5 77 35 7, tab 3
text "Team 2 Wins", 320, 5 92 35 7, tab 3
edit [ %trivia.team.0.victory ], 305, 38 61 139 10, tab 3 autohs
edit [ %trivia.team.1.victory ], 315, 38 76 139 10, tab 3 autohs
edit [ %trivia.team.2.victory ], 325, 38 91 139 10, tab 3 autohs
box "Team Names", 7, 2 13 177 40, tab 3
box "Messages", 8, 2 54 177 60, tab 3
tab "Awards", 4
box "Row Messages", 400, 2 13 177 52, tab 4
box "Score Messages", 401, 2 66 177 48, tab 4
text "50 wins", 410, 4 74 21 7, tab 4
text "100 wins", 420, 4 84 21 7, tab 4
text "150 wins", 430, 4 94 21 7, tab 4
edit [ %trivia.award.score.50 ], 415, 25 73 152 10, tab 4 autohs
edit [ %trivia.award.score.100 ], 425, 25 83 152 10, tab 4 autohs
edit [ %trivia.award.score.150 ], 435, 25 93 152 10, tab 4 autohs
text "3 row", 440, 4 21 20 6, tab 4
text "5 row", 450, 4 32 20 6, tab 4
text "10 row", 460, 4 43 20 6, tab 4
text "15 row", 470, 4 53 20 6, tab 4
edit [ %trivia.award.row.3 ], 445, 25 20 151 10, tab 4 autohs
edit [ %trivia.award.row.5 ], 455, 25 31 151 10, tab 4 autohs
edit [ %trivia.award.row.10 ], 465, 25 42 151 10, tab 4 autohs
edit [ %trivia.award.row.15 ], 475, 25 53 151 10, tab 4 autohs
text "* becomes winners nick. ^ becomes number of streak/score.", 480, 13 104 152 7, tab 4
tab "Status", 5
text "Trivia Script version:", 500, 5 20 75 10, tab 5
text [ $msg.trivia.version ], 501, 92 20 75 10, tab 5
text "Trivia bot is currently:", 503, 5 33 75 10, tab 5
text [ $trivon ], 504, 92 33 40 10, tab 5
text "Current mIRC version is:", 505, 5 46 75 10, tab 5
text [ $version ], 506, 92 46 40 10, tab 5
text "Current Trivia directory exists:", 507, 5 59 75 10, tab 5
text [ $trivia.dir ], 508, 92 59 40 10, tab 5
text "Currently in Trivia Channel:", 509, 5 72 77 10, tab 5
text [ $trivia.dir ], 510, 92 72 40 10, tab 5
text "Question file in Trivia Directory:", 511, 5 85 80 10, tab 5
text [ $trivia.dir ], 512, 92 85 40 10, tab 5
text "Number of questions:", 513, 5 98 81 10, tab 5
text [ $numq ], 514, 92 98 75 10, tab 5
box "General Infomation", 9, 2 13 177 101, tab 5
button "OK", 100, 71 117 40 12, flat ok
}
on *:dialog:options:sclick:100:{
%trivia.channel = $did(45)
%trivia.questions = $did(55)
%trivia.additions = $did(65)
%trivia.report = $did(75)
%trivia.delimiter = $did(85)
%trivia.dir = $did(95)
%trivia.lag.start = $did(135)
%trivia.lag.answered = $did(145)
%trivia.lag.timedout = $did(155)
%trivia.lag.hint = $did(165)
%trivia.lag.timed = $did(175)
%trivia.lag.hintallow = $did(186)
%trivia.team.1 = $did(185)
%trivia.team.2 = $did(195)
%trivia.default = $did(205)
%trivia.reset = $did(215)
%trivia.status.autohint = $did(225).state
%trivia.status.champ = $did(235).state
%trivia.status.oponly = $did(245).state
%trivia.team.0.victory = $did(305)
%trivia.team.1.victory = $did(315)
%trivia.team.2.victory = $did(325)
%trivia.award.score.50 = $did(415)
%trivia.award.score.100 = $did(425)
%trivia.award.score.150 = $did(435)
%trivia.award.row.3 = $did(445)
%trivia.award.row.5 = $did(455)
%trivia.award.row.10 = $did(465)
%trivia.award.row.15 = $did(475)
savem
}
on *:dialog:options:init:*:{
if (%trivia.status.autohint == 1) { did -c options 225 }
if (%trivia.status.champ == 1) { did -c options 235 }
if (%trivia.status.oponly == 1) { did -c options 245 }
}
menu menubar,channel {
-
Trivia
.Start Trivia
..Standard:$trivia
..Unlimited Game:$trivia(unlimited)
..Team Game:$trivia(team)
..Specify round:{ $trivia($$?="How many question in the trivia round?") }
.Stop Trivia:strivia
.-
.Force Question:ask
.Echo
..Records:msg %trivia.channel $font $msg.trivia.records $+
..HoF:msg %trivia.channel $font $msg.trivia.hof $+
..Fast:msg %trivia.channel $font $msg.trivia.record.time $+
..Repeat:msg %trivia.channel $font $msg.question.current $+
..Hint:hint
.Open
..Questions:if $exists(%trivia.dir $+ / $+ %trivia.questions) { run %trivia.dir $+ / $+ %trivia.questions }
..Additions:if $exists(%trivia.dir $+ / $+ %trivia.additions) { run %trivia.dir $+ / $+ %trivia.additions }
..Report:if $exists(%trivia.dir $+ / $+ %trivia.report) { run %trivia.dir $+ / $+ %trivia.report }
.-
.Set Room:%trivia.channel = $chan
.Set Directory:set %trivia.dir $mircdir
.~Options~:dialog -mh options options
..Reset
..Sure:init
.-
.Trivia [ $trivon ] $+ :%trivia.status.bot = $calc((%trivia.status.bot - 1) * -1)
}
alias trivon {
if (%trivia.status.bot == 1) { return On }
else { return Off }
}
alias trivia.chan {
if (%trivia.channel !ischan) { return No }
else { return Yes }
}
alias trivia.dir {
if ($isdir(%trivia.dir) == $false) { return No }
else { return Yes }
}
alias trivia.file {
if ($isfile(%trivia.dir $+ \ $+ %trivia.questions) == $false) { return No }
else { return Yes }
}
alias msg.answer.correct { return $nick got the answer: %trivq.answer $+ . In: %question.time secs. Streak: %trivia.row $+ . $msg.trivia.wins $+ ! $msg.trivia.rank }
alias msg.question.current { return %trivia.status.question $+ . $tok(1) $+ ? }
alias msg.question.hint { return Here's a hint: $left(%trivq.answer, $int($calc(($len(%trivq.answer) / 3) + 1 ))) }
alias msg.question.hint2 { return Here's a hint: $left(%trivq.answer, $int($calc(($len(%trivq.answer) / 3) + 2 ))) }
alias msg.question.bighint { return Here's a big hint: $left(%trivq.answer, $int($calc(($len(%trivq.answer) / 3) + 5 ))) }
alias msg.question.vowels { return Vowels are: $get.vowels }
alias msg.trivia.stopped { return Stopping the trivia. }
alias msg.trivia.victory { return The game has been beaten by %trivia.lastwinner all hail the new champ whose name shall reign supreme! }
alias msg.trivia.started { return Starting the trivia. }
alias msg.trivia.times_up { return Times up! The answer was: %trivq.answer }
alias msg.trivia.give_up { return You've given up!!! The answer was: %trivq.answer $+ . Better luck next time. }
alias msg.trivia.record.row { return Record streak: %record.row held by, %record.name }
alias msg.trivia.record.time { return Record time: %record.time held by, %record.time.name }
alias msg.trivia.record.champ { return Current champ: %trivia.hof.champ $+ ... }
alias msg.trivia.hof { return $msg.trivia.record.champ %hof1.name is leading the pack: $hofscore(1) wins $highscores $+ ! }
alias msg.trivia.records { return $msg.trivia.hof $+ . $msg.trivia.record.row $+ . $msg.trivia.record.time $+ . }
alias msg.trivia.rank { return You rank number: $getrank($nick) $+ ! }
alias msg.trivia.thanks { return Thank you for your contribution! }
alias msg.trivia.version { return Hybrid Trivia Workin' Trivia 1.1 }
alias msg.trivia.wins { return Current wins $score($nick) }
alias msg.team.start { return Team Trivia: ' $+ !join 1 $+ ' or ' $+ !join 2 $+ ' to add to a team. }
alias msg.team.add { return Team: %add.team has a new member: %add.name }
alias msg.team.joinover { return I am sorry no more people can join/change at this time. }
alias msg.team.score { return %trivia.team.1 has %team.score.1 points. %trivia.team.2 has %team.score.2 points. }
alias highscores {
var %temp
var %i = 2
while (($hofscore(%i) != $null) && (%i <= 10)) {
%temp = %temp; %i $+ ) $+ $chr(32) $+ % [ $+ hof $+ [ %i ] $+ .name ] $+ $chr(32) $+ - $+ $chr(32) $+ $hofscore( %i )
inc %i
}
return %temp
}
alias msg.trivia.champs {
var %temp $msg.trivia.record.champ
var %i = 1
while (%i <= %trivia.hof.champ.size) {
%temp = %temp %trivia.hof.champ. [ $+ [ %i ] ]
inc %i
}
return %temp
}
alias nset { if ( % [ $+ [ $1 ] ] == $null) { % [ $+ [ $1 ] ] = $2- } }
alias init {
unset %trivia*
nset { trivia.status.bot 1 }
nset { trivia.status.champ 0 }
nset { trivia.status.number 30 }
nset { trivia.status.autohint 0 }
nset { trivia.status.oponly 0 }
nset { trivia.lastwinner Nobody }
nset { trivia.additions additions.txt }
nset { trivia.channel #temptrivia }
nset { trivia.default 1000 }
nset { trivia.delimiter * }
nset { trivia.dir $mircdir }
nset { trivia.lag.answered 10 }
nset { trivia.lag.hint 10 }
nset { trivia.lag.start 10 }
nset { trivia.lag.timed 10 }
nset { trivia.lag.timedout 40 }
nset { trivia.lag.hintallow 10 }
nset { trivia.questions questions2.txt }
nset { trivia.report report.txt }
nset { trivia.reset 1000 }
nset { trivia.team.0.victory There is no winner, you are both losers... }
nset { trivia.team.1 Blue }
nset { trivia.team.1.victory The Blue crushed the Red.... }
nset { trivia.team.2 Red }
nset { trivia.team.2.victory The Red crushed the Blue.... }
nset { trivia.award.row.3 gives * a (B) or even a (D) for your ^ win's }
nset { trivia.award.row.5 you are getting better you clever trivia (6) * , ^ win's }
nset { trivia.award.row.10 :D Congratulations * , you're on a roll with them ^ win's }
nset { trivia.award.row.15 you are intelligent * , with your ^ win's and your still going strong :D }
nset { trivia.award.score.50 gives you * a (D) you must think its your birthday you trivia buff for getting ^ win's (h5)for them :) }
nset { trivia.award.score.100 gives you * a special big pat on the back and (h5) for scoring so many ^ win's you are becoming a legend :D }
nset { trivia.award.score.150 ^ win's you really are the trivia legend * and we will be throwing a big party <:o) for you to celebrate your wins :D }
%trivia.status.cur = 0
%trivia.teammode = 0
%trivia.row = 0
unset %player*
unset %record*
unset %hof*
}
alias givehelp {
notice $nick !trivia x - Starts trivia, x can be a number, "unlimited" or "team" for team mode
notice $nick !strivia - Stops trivia
notice $nick !hint - Gives a hint ** !!hint - Gives a bigger hint
notice $nick !vowels - Gives vowels
notice $nick !repeat - Repeats the question ** !giveup - Ends current question
notice $nick !wins - Returns your current wins ** !rank - Returns your current rank
notice $nick !hof - Displays the hall of fame ** !fast - Displays the record time
notice $nick !champ - Displays the champ stats ** !row - Displays the record row
notice $nick !join x - Joins a team, must be in team mode, x can be a 1 or 2
notice $nick !add - Allows you to add questions ** !report - Lets you report problems with the questions
notice $nick !version - Displays the version of the bot
}
alias trivia.fail {
if (%trivia.status.bot == 0) { echo The trivia bot is off. | return $true }
if (%trivia.channel !ischan) { echo You are not in the set trivia channel: %trivia.channel | return $true }
if ($isdir(%trivia.dir) == $false) { echo Trivia Directory Invalid! | return $true }
if ($isfile(%trivia.dir $+ \ $+ %trivia.questions) == $false) { echo Question file not found | return $true }
if ($version < 5.9) { echo Please use mIRC 5.9 or later. | return $true }
}
alias trivia {
if ((%trivia.status.cur == 1) || ($trivia.fail)) { return }
if ( ($1 != $null) && ($1 <= $numq ) && ($int($1) > 0) ) { %trivia.status.number = $int($1) }
else { %trivia.status.number = %trivia.default }
%trivia.status.question = 0
%trivia.status.asked = 0
if ($1 == unlimited) {
%trivia.status.number = Unlimited
}
msg %trivia.channel $font $msg.trivia.started $+
if ( $1 == team ) {
%trivia.teammode = 1
%team.score.1 = 0
%team.score.2 = 0
msg %trivia.channel $font $msg.team.start $+
}
%trivia.status.cur = 1
.timertrivia1 1 %trivia.lag.start trivq
}
alias strivia {
if (%trivia.status.cur == 0) { return }
if ( %trivia.teammode == 1 ) {
if (%team.score.1 == %team.score.2) { var %temp = %trivia.team.0.victory }
if (%team.score.1 > %team.score.2) { var %temp = %trivia.team.1.victory }
if (%team.score.1 < %team.score.2) { var %temp = %trivia.team.2.victory }
msg %trivia.channel $font $replace($replace(%temp, *t1, %trivia.team.1),*t2, %trivia.team.2) $+ ! $+
}
unset %trivq.*
unset %asked.*
unset %question.*
if (%trivia.teammode == 0) { msg %trivia.channel $font $msg.trivia.stopped $+ }
if ((%trivia.teammode == 0) && ( %trivia.status.question >= 10)) { msg %trivia.channel $font $msg.trivia.records $+ }
unset %team.*
%trivia.teammode = 0
%trivia.status.cur = 0
.timertrivia* off
savem
haltdef
}
alias trivq {
if (%trivia.status.bot == 0) { echo The trivia bot is off. | strivia }
if (%trivia.status.cur == 0) { return }
inc %trivia.status.question
inc %trivia.status.asked
if (%trivia.status.asked > $numq) { unset %asked.* | %trivia.status.asked = 1 }
if (%trivia.ask != $null) { $setask( %trivia.ask ) }
while ($is_repeat) { $setask( $rand(0, $numq) ) }
%trivq.question = $read( %trivia.questions, $asked( %trivia.status.asked ) )
%trivq.answer = $tok(2)
unset %trivia.ask
msg %trivia.channel $font $msg.question.current $+
%question.answered = $false
.timertrivia2 1 %trivia.lag.timedout trivx
if ( %trivia.status.autohint == 1 ) { .timertrivia3 1 %trivia.lag.hint hint }
%question.start = $ticks
echo 4 %trivia.channel -> %trivq.answer -> $asked( %trivia.status.asked )
}
alias get.vowels {
var %vowels
set %voweltmp $regsub(%trivq.answer,/([^aeiouAEIOU ])/g,_,%vowels)
return %vowels
}
alias is_repeat {
if ($asked( %trivia.status.asked ) == $null) { return $true }
if ($read(%trivia.questions, $asked(%trivia.status.asked)) == $null) { return $true }
var %i = 1
while (%i < %trivia.status.asked) {
if ( $asked( %i ) == $asked( %trivia.status.asked ) ) { return $true }
inc %i
}
return $false
}
alias asked { return % [ $+ asked. $+ [ $1 ] ] }
alias setask { % [ $+ asked. $+ [ %trivia.status.asked ] ] = $1 }
alias trivg {
if (%question.answered == $false) {
msg %trivia.channel $font $msg.trivia.give_up $+
%trivia.row = 0
}
.timertrivia* off
unset %trivq.*
if (($score($nick) >= %trivia.reset) && (%trivia.status.champ == 1)) {
unset %hof*
unset %player.*
unset %record.*
inc %trivia.hof.champ.size
%trivia.hof.champ. [ $+ [ %trivia.hof.champ.size ] ] = %trivia.hof.champ
%trivia.hof.champ = %trivia.lastwinner
msg %trivia.channel $font $msg.trivia.victory $+
strivia
}
if (%trivia.status.number != unlimited) && ( %trivia.status.question >= %trivia.status.number ) { strivia }
var %temp.lag
if (%question.answered) { %temp.lag = %trivia.lag.answered }
else { %temp.lag = %trivia.lag.timed }
.timertrivia1 1 %temp.lag trivq
unset %question.*
}
alias trivx {
if (%question.answered == $false) {
msg %trivia.channel $font $msg.trivia.times_up $+
%trivia.row = 0
}
.timertrivia* off
unset %trivq.*
if (($score($nick) >= %trivia.reset) && (%trivia.status.champ == 1)) {
unset %hof*
unset %player.*
unset %record.*
inc %trivia.hof.champ.size
%trivia.hof.champ. [ $+ [ %trivia.hof.champ.size ] ] = %trivia.hof.champ
%trivia.hof.champ = %trivia.lastwinner
msg %trivia.channel $font $msg.trivia.victory $+
strivia
}
if (%trivia.status.number != unlimited) && ( %trivia.status.question >= %trivia.status.number ) { strivia }
var %temp.lag
if (%question.answered) { %temp.lag = %trivia.lag.answered }
else { %temp.lag = %trivia.lag.timed }
.timertrivia1 1 %temp.lag trivq
unset %question.*
}
alias answered {
if (( %trivia.teammode == 1 ) && ( $teamname( $nick ) == $null)) { return }
%question.time = $question.time
inc % [ $+ player. $+ [ $nick ] ]
if (%trivia.lastwinner == $nick) { inc %trivia.row }
else { %trivia.row = 1 | %trivia.lastwinner = $nick }
if ((%trivia.row > %record.row) || (%record.row == $null)) { %record.row = %trivia.row | %record.name = $nick }
if ((%question.time < %record.time) || (%record.time == $null)) { %record.time = %question.time | %record.time.name = $nick }
msg %trivia.channel $font $msg.answer.correct $+
award
if ( $getrank(%trivia.lastwinner) == $null ) {
% [ $+ hof $+ [ $hof.size ] $+ .name ] = %trivia.lastwinner
}
sort
if (%trivia.teammode == 1) {
inc % [ $+ team.score. $+ [ % [ $+ team. $+ [ %trivia.lastwinner ] ] ] ] )
msg %trivia.channel $font $msg.team.score $+
}
%question.answered = $true
trivx
halt
}
alias hof.size {
var %i = 1
while ($hofname(%i) != $null) {
inc %i
}
return %i
}
alias sort {
var %i = 2
while ($hofname(%i) != $null) {
var %inserted = $false
var %j = %i
while ((%j >= 1) && (%inserted == $false)) {
if ($hofscore(%j) > $hofscore($calc(%j - 1))) {
var %temp = $hofname(%j)
% [ $+ hof $+ [ %j ] $+ .name ] = $hofname($calc(%j - 1))
% [ $+ hof $+ [ $calc(%j - 1) ] $+ .name ] = %temp
}
else { %inserted = $true }
dec %j
}
inc %i
}
}
alias award {
var %temp = % [ $+ trivia.award.score. $+ [ $score($nick) ] ]
if (%temp != $null) {
%temp = $replace(%temp,^, $score($nick))
%temp = $replace(%temp,*, $nick)
describe %trivia.channel %temp
}
var %temp = % [ $+ trivia.award.row. $+ [ %trivia.row ] ]
if (%temp != $null) {
%temp = $replace(%temp,^, $+ %trivia.row $+ )
%temp = $replace(%temp,*, $+ $nick $+ )
describe %trivia.channel %temp
}
}
alias getrank {
var %i = 1
while ($hofname(%i) != $null) {
if ( $1 == $hofname(%i)) { return %i }
inc %i
}
}
alias setteam {
if (%trivia.status.question >= 2) { notice $nick $msg.team.joinover | return }
if (($2 == 1) || ($2 == 2)) {
%add.team = %trivia.team. [ $+ [ $2 ] ]
%add.name = $nick
%team. [ $+ [ $1 ] ] = $2
msg %trivia.channel $font $msg.team.add $+
unset %add.*
}
}
alias fix {
var %temp = $1-
%temp = $remove(%temp,',-,`,.,%,the)
%temp = $replace(%temp,kn,n)
%temp = $replace(%temp,y,i)
%temp = $replace(%temp,k,c)
%temp = $replace(%temp,x,c)
%temp = $replace(%temp,q,c)
%temp = $replace(%temp,e,a)
%temp = $replace(%temp,u,o)
%temp = $replace(%temp,ph,f)
%temp = $replace(%temp,m,n)
%temp = $replace(%temp,ll,l)
%temp = $replace(%temp,aa,a)
%temp = $replace(%temp,oo,o)
%temp = $replace(%temp,cc,c)
if ($right(%temp, 1) == s) { %temp = $left(%temp, $calc($len(%temp) - 1)) }
return %temp
}
alias hint { msg %trivia.channel $font $msg.question.hint $+ }
alias savem { save -rv vars.ini | %trivia.status.save = 0 }
alias savevar { inc %trivia.status.save | if (%trivia.status.save == 5) { savem } }
alias numq { return $lines(%trivia.dir $+ \ $+ %trivia.questions) }
alias tokq { return $numtok(%trivq.question, $asc(%trivia.delimiter)) }
alias question.time { return $calc(($ticks - %question.start) / 1000) }
alias score { if (% [ $+ player. $+ [ $1 ] ] == $null) { return 0 } | return % [ $+ player. $+ [ $1 ] ] }
alias hofname { return % [ $+ hof $+ [ $1 ] $+ .name ] }
alias hofscore { return $score($hofname($1)) }
alias teamscore { return ( % [ $+ team.score. $+ [ % [ $+ team. $+ [ $1 ] ] ] ] ) }
alias teamname { return %team. [ $+ [ $1 ] ] }
alias tok { return $gettok(%trivq.question,$1,$asc(%trivia.delimiter)) }
alias ask {
var %tempnumber
if ($1 == $null) { %tempnumber = $?="Force which question (number) to be asked?" }
else { %tempnumber = $1 }
if (( %tempnumber < 1 ) || ( %tempnumber > $numq )) { echo Error, invalid | return }
%trivia.ask = %tempnumber
}
alias trivon {
if (%trivia.status.bot == 1) { return On }
else { return Off }
}
alias trivia.chan {
if (%trivia.channel !ischan) { return No }
else { return Yes }
}
;Do not edit this alias or it will mess up the auto updater
alias hybrid.trvver return 1.0