alias strivia {
set -u3 %ident $1
if ($team) { strivia.teammode }
else if ($getset(status,bot)) {
if ($getset(Var $+ $idenn, Lastwinner) == $nick) { setset Var $+ $idenn Row 0 }
tsay $msg.trivia.stopped
if ($thget(Current) >= 10) { tsay $strivia.end($triv(Record)) }
award RoundStop $thget(Current)
}
trivia.flush
}
alias strivia.end {
if ($1 == 1) { return $msg.trivia.hof }
elseif ($1 == 2) { return $msg.trivia.topstats(streak) }
elseif ($1 == 3) { return $msg.trivia.topstats(time) }
elseif ($1 == 4) { return $msg.trivia.topstats(wpm) }
elseif ($1 == 5) { return $msg.trivia.champ }
elseif ($1 == 6) { return $msg.trivia.web }
elseif ($1 == 7) { return $msg.trivia.roundscores }
return $msg.trivia.records
}
alias trivx {
set -u3 %ident $1
if (!$hget(Trivia $+ $idenn)) { return }
if (!$2) {
if (($getset(status,showanswer)) && (!$getset(status,shownone))) { tsay $iif($thget(temp.type) == T, $msg.answer.timeout.total, $iif($thget(temp.type) == P, $msg.answer.timeout.pick, $msg.answer.timeout)) }
else { tsay $msg.answer.timeout2 }
setset Var $+ $idenn Row 0
thset Unanswered $calc($thget(Unanswered) + 1)
}
trivia.timersoff
if ($window($total.win)) { window -c $total.win }
thset Answer $trivq.answer
if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn Temp.*
if ($hget(Trivia $+ $idenn)) hdel -w Trivia $+ $idenn tok*
if (($nick) && ($getvar($nick,score) >= $triv(reset)) && ($getset(status,champ) == 1)) { trivia.newchamp }
if ((($team) && ($thget(Score $+ $isteam($nick)) > $calc($thget(Max)/2))) || (($getset(status,emptyoff)) && ($nick($iden,0) <= 1)) || (($getset(status, naoff) == 1) && ($thget(unanswered) >= $triv(naoff))) || (($thget(Max) != unlimited) && ($thget(Current) >= $thget(Max)))) {
strivia $1
if (($getset(status, emptyoff) == 1) && ($nick($iden,0) <= 1)) tsay $msg.trivia.emptyoff
if (($getset(status, naoff) == 1) && ($thget(Unanswered) >= $triv(naoff))) tsay $msg.trivia.unactive
return
}
.timerq $+ $idenn 1 $iif($1, $lag(answered), $lag(timed)) trivq $iden
}
alias -l trivia.processscore {
if ($getset(Var $+ $idenn, Lastwinner) == $nick) { setset Var $+ $idenn Row $calc($getset(Var $+ $idenn, Row) + $ifd($2,1)) }
else { setset Var $+ $idenn Row $ifd($2,1) }
setset Var $+ $idenn Wins $calc($getset(Var $+ $idenn,Wins) + $ifd($2,1))
setset Var $+ $idenn Lastwinner $nick
setvar $nick Lastwin $date
thset WPM $calc(($len($1) * 60) / ($thget(Time) * 5))
if (($thget(WPM) > $realvar($nick,wpm)) || (!$realvar($nick,wpm))) { setvar $nick wpm $thget(WPM) }
if (($getset(Var $+ $idenn, Row) > $realvar($nick,streak)) || (!$realvar($nick,streak))) { setvar $nick Streak $getset(Var $+ $idenn, Row) }
if (($thget(Time) < $realvar($nick,time)) || (!$realvar($nick,time))) { setvar $nick Time $thget(Time) }
thset temp.cng $calc(($thget(PPQ) * $ifd($2,1)) - ($thget(DPH) * $max.hinted))
if ($thget(temp.points) != $null) { thset temp.cng $calc(($thget(temp.points) - ($max.hinted * $thget(temp.hintreduction))) * $ifd($2,1)) }
thset temp.mrank $getmrank($nick)
thset temp.rank $getrank($nick,$unit.default,$thget(temp.cng))
thset temp.newrank $calc($thget(temp.rank) - %uprank)
setvar $nick Score $calc($realvar($nick, Score) + $thget(temp.cng))
setvar $nick Answered $calc($realvar($nick, Answered) + $iif($2 > 0,$2,1))
thset $eval(Score. $+ $nick,1) $calc($thget($eval(Score. $+ $nick,1)) + $thget(temp.cng))
process.scores.time $nick $thget(temp.cng) $getset(Var $+ $idenn, Row) $thget(Time) $thget(WPM)
}
alias trivia.processawards {
if (%uprank) award uprank $tranord($thget(temp.newrank))
if ($getmrank($nick) != $thget(temp.mrank)) award promotion $getmrank($nick)
award score $user.score($nick)
award row $getset(Var $+ $idenn, Row)
award time $thget(Time)
award wpm $thget(WPM)
award answered $thget(Time)
}
alias -l answered {
thset Time $question.time
if (($1 == $null) || ($trivia.banned) || ($trivia.negationcheck) || (($team) && (!$isteam($nick)))) { return }
$trivia.processscore($1,$2)
if (($getset(build,instabuild)) && ($getset(build,instabuild) // $getset(Var $+ $idenn,Wins))) { htmltrigger $iden }
tsay $msg.answer.correct($getset(status,tradwin),$thget(WPM),$thget(temp.newrank),$iif(%uprank,$thget(temp.rank)))
if ($team) {
thset Score $+ $isteam($nick) $calc($thget( Score $+ $isteam($nick)) + 1)
tsay $msg.team.score
}
trivia.processawards
if ($thget(RRS)) { tsay $msg.trivia.roundscores }
hdel Trivia $+ $idenn Unanswered
if ($total.over) { tsay $msg.trivia.totalover }
if (($thget(temp.type) != T) || ($total.over)) { trivx $chan $true }
}
alias -l trivq.answer { return $iif(((($thget(temp.type) == T) || ($getset(status,showmatched))) && ($thget(temp.matched))), $thget(temp.matched),$tok(2)) }
;########################################################
;# QUESTION Typing. #
;########################################################
alias -l trivia.sayquestion {
if ($regex($tok(1), /^([^:]+):\s?(.+)|((?i)Scramble|Uword)$/)) {
thset temp.mode $regml(1)
thset temp.rest $regml(2)
if (($gettok($thget(temp.mode),1,44) isnum) && ($getset(status,nobonus) != 1)) {
thset temp.points $gettok($thget(temp.mode),1,44)
if ($gettok($thget(temp.mode),2,44) isnum) { thset temp.hintreduction $gettok($thget(temp.mode),2,44) }
var %tq $msg.question.points($1-,$thget(temp.rest))
}
elseif ($regex($lower($thget(temp.mode)), /pick\s(\d+)/)) {
var %tq $msg.question.standard($1-,$thget(temp.rest))
thset temp.type P
thset temp.pick $regml(1)
}
elseif (Multi == $thget(temp.mode)) {
var %tq $msg.question.multi($1-)
thset temp.type M
}
elseif (Total == $thget(temp.mode)) {
var %tq $msg.question.total($1-)
thset temp.type T
total.init
}
elseif (Scramble == $thget(temp.mode)) || (UWord == $thget(temp.mode)) {
var %tq $msg.question.scramble($1-,$thget(temp.rest))
thset temp.type S
}
}
if (!%tq) { var %tq $msg.question.standard($1-) }
thset trivq.say $iif($getset(status,nosaycurrent) != 1, $e1($thget(Current)) $+ $e2(.)) $decheater(%tq)
tsay $thget(trivq.say)
}
;########################################################
;# TOTAL question type, control. #
;########################################################
alias unfix {
var %i = 2
while (%i <= $tokq) {
if ($1- == $fix($tok(%i))) { return $tok(%i) }
inc %i
}
}
alias total.win { return @total $+ $idenn }
alias total.init {
var %i = 2
if ($window($total.win)) { window -c $total.win }
window -h $total.win
while (%i <= $tokq) {
aline -n $total.win $tok(%i)
inc %i
}
}
alias total.left { return $line($total.win,0) }
alias total.is { return $fline($total.win,$1-,1) }
alias total.rem { dline $total.win $total.is($1-) }
alias total.over { return $iif(!$line($total.win,0) && ($thget(temp.type) == T), 1) }
alias gettotalremain {
var %i = 1, %totalremain
while (%i <= $line($total.win,0)) {
%totalremain = $left(%totalremain,850) $+ $iif(%totalremain != $null,$chr(44)) $line($total.win,%i)
inc %i
}
return %totalremain
Had to sorten it I think it's in here