rendered paste bodyon *:text:!triviaon:#:{
if (%trivia.status [ $+ [ $chan ] ] == on) {
notice $nick 12Trivia 4Error 1-12 Trivia is 4already running12 in4 $chan $+ 12! | halt
}
else {
set %trivia.chan [ $+ [ $chan ] ] $chan
set %trivia.status [ $+ [ $chan ] ] on
msg $chan 12Trivia has been turned 4on12 by4 $nick $+ 12! If you want it 4off12 please type4 "!triviaoff"12.
aliasstrivia
} }
on *:text:!triviaoff:#:{
if (%trivia.chan [ $+ [ $chan ] ] == off || %trivia.chan [ $+ [ $chan ] ] == $null) {
notice $nick 12Trivia 4Error 1-12 Trivia is already 4off12 in4 $chan $+ 12! | halt
}
else {
msg $chan 12Trivia has been turned 4off12 by4 $nick $+ 12! If you want it 4on12 please type4 "!triviaon"12.
unset %trivia.chan [ $+ [ $chan ] ]
set %trivia.status [ $+ [ $chan ] ] off
set %trivia.number [ $+ [ $chan ] ] 0
} }
on *:text:!atq*:#:{ if ($nick isop #erabot) {
write tqs.txt $2-
notice $nick The Question*Answer; $2- ;Has Been Added To The Question List
} }
alias randhint {
var %x .8 * $len($1),%y $1
while (.8 < %x) dec %x $regsub(%y,(.{ $+ $r(0,950) $+ })[^_],\1_,%y)
return %y
}
alias aliasstrivia {
inc %trivia.number [ $+ [ $chan ] ] 1
set %trivia.q [ $+ [ $chan ] ] $gettok($read(tqs.txt),1,42)
set %trivia.qa [ $+ [ $chan ] ] $gettok($read(tqs.txt,$readn),2,42)
msg %trivia.chan [ $+ [ $chan ] ] 12 $+ $readn $+ 4.12 %trivia.q [ $+ [ $chan ] ] $+
msg %trivia.chan [ $+ [ $chan ] ] 12Random Hint:4 $randhint($gettok($read(tqs.txt,$readn),2,42)) $+
.timertrivia $+ $chan 1 20 msg $chan 12Your time has run out! Answer:4 %trivia.qa [ $+ [ $chan ] ] $+ | aliasstrivia
}
on *:text:*:#:{
if (%trivia.status [ $+ [ $chan ] ] == on) {
if $timer($+(trivia,$chan)) {
if (%trivia.qa [ $+ [ $chan ] ] iswm $1-) {
inc %trivia.win [ $+ [ $nick ] ] 1
msg $chan 1|Winner| 1-12 Nick:4 $nick 1- 12Answer:4 %trivia.qa [ $+ [ $chan ] ] 1-12 $nick $+ 's Wins:4 %trivia.win [ $+ [ $nick ] ] 1-
aliasstrivia
} } } }