All pastes #416182 Raw Edit

Untitled

public text v1 · immutable
#416182 ·published 2007-03-30 03:16 UTC
rendered paste body
on $*:TEXT:/^[!@]s?trivia/Si:#:{
  if (s isin $1) stop-trivia $chan $nick
  else start-trivia $chan $nick  
}
on *:TEXT:*:#:$iif($istok($readini(trivia.ini,$chan,canswer),$1-,$asc(|)),grats-trivia $chan $nick)
alias -l start-trivia {
  if ($readini(trivia.ini,$1,game)) { notice $2 there is already a game going in $1 | halt }
  else {
    writeini trivia.ini $1 game on
    $+(.timer,$1) 1 10 next-question $1 newgame
    msg $1 game started in $1 unlimited questions! started by $2
  }
}
alias -l stop-trivia {
  if ($timer($1)) $+(.timer,$1) off
  if ($timer($+($1,.miss))) $+(.timer,$1,.miss) off
  msg $1 Game ended!
  remini trivia.ini $1
}
alias -l grats-trivia {
  remini trivia.ini $1 cquestion
  remini trivia.ini $1 canswer
  msg $1 congrats $2 you got teh correct answ0r!
  $+(.timer,$1) 1 5 next-question $1
}
alias -l next-question {
  if ($2 == newgame) msg $1 First round!
  if ($2 == miss) {
    msg $1 Sorry you missed the question! the answer was $gettok($readini(trivia.ini,$1,canswer),1,$asc(|))
    remini trivia.ini $1 canswer
    remini trivia.ini $1 cquestion
  }
  else $+(.timer,$1,.,miss) off
  var %q = $read(qz.txt)
  writeini trivia.ini $1 cquestion $gettok(%q,1,$asc(@))
  writeini trivia.ini $1 canswer $gettok(%q,2,$asc(@)))
  msg $1 $gettok(%q,1,$asc(@))
  $+(.timer,$1,.,miss) 1 20 next-question $1 miss
}