on *:text:!tri.add *:#: {
if ($3 == $null) //notice $nick Please specify a question. Syntax: !tri.add QUESTION:ANSWER.
else {
/write trivia.txt $gettok($2-,1,58) : $+ $gettok($2-,2,58)
//notice $nick Your question and the correct answer has been set. Thanks for supplying.
/write trivia.new.txt $gettok($2-,1,58) : $+ $gettok($2-,2,58) }
}
on *:text:!tri.start:#: {
if ($eval($+(%,trivia.,$chan),2) == running) /notice $nick There's already a trivia game running.
else {
/describe $chan (Trivia) A new game of trivia has been started! The game-related messages will be shown in 12blue.
triviaset
}
}
on *:text:!tri.end:#: {
if ($eval($+(%,trivia.,$chan),2) == running) {
/unset $+(%,trivia.,question.,$chan)
/unset $+(%,trivia.,answer.,$chan)
/unset $+(%,trivia.,$chan)
/unset $+(%,trivia.ans.quest.,$chan)
//msg $chan 12 $+ Trivia has ended! 7 $+ $nick 12has ended the trivia in7 $chan $+ 12! }
else {
//notice $nick There isn't a Trivia Game running! Type !trivia.start to start one! }
}
on *:text:!tri *:#: {
if ($eval($+(%,trivia.answer.,$chan),2) == $2-) {
//msg $chan $nick 12got the Trivia correct! The answer of7 $eval($+(%,trivia.,question.,$chan),2) 12was7 $eval($+(%,trivia.,answer.,$chan),2) $+ 12!
inc $+(%,trivia.score.,$nick)
//notice $nick You have now $eval($+(%,trivia.score.,$nick),3) points
/timertri 1 5 triviaset $chan
}
else //notice $nick That isn't the correct answer! The Trivia was:7 $eval($+(%,trivia.,question.,$chan),2)
}
alias triviaset {
/set $+(%,trivia.,$chan) running
/set $+(%,trivia.ans.quest.,$chan) $read(trivia.txt)
/set $+(%,trivia.,question.,$chan) $gettok($eval($+(%,trivia.ans.quest.,$chan),2),1,58)
/set $+(%,trivia.,answer.,$chan) $gettok($eval($+(%,trivia.ans.quest.,$chan),2),2,58)
/msg $1 12New question set! The new question is:7 $eval($+(%,trivia.,question.,$chan),2) 12To take a guess on the correct answer, type !tri ANSWER }
(C) Just|A|Bot aka Mage_mark