All pastes #802554 Raw Edit

Untitled

public text v1 · immutable
#802554 ·published 2007-11-30 12:01 UTC
rendered paste body
on $*:text:/^[!@.`]((s)?(triv)(ia)?|game|trivia(-on|-off)?( on| off)?)/Si:#trivia: {
  if ((strivia isin $1 || $right($1-,3) == off) && %trivia != off) { 
    set %trivia off
    timerstart off
    timerhint1 off
    timerhint2 off
    msg $chan 12Trivia halted by14 $nick $+ 12.
  }
  elseif (%trivia != on) { 
    set %trivia on
    set %trivia.chan $chan
    msg $chan 12Trivia started by14 $nick $+ 12.
    msg $chan 12Starting in14 512 seconds.
    start
  }
  else { 
    notice $nick 3You can't do this!
  }
}

alias -l start {
  set %trivia.lines $lines(trivia.txt)
  set %trivia.line $r(1,%trivia.lines)
  timerstart 1 5 data
}

alias -l data {
  set %trivia.cat $gettok($read(trivia.txt,%trivia.line),1,124)
  set %trivia.ques $gettok($read(trivia.txt,%trivia.line),2,124)
  set %trivia.hint1 $gettok($read(trivia.txt,%trivia.line),3,124)
  set %trivia.hint2 $gettok($read(trivia.txt,%trivia.line),4,124)
  set %trivia.ans $gettok($read(trivia.txt,%trivia.line),5,124)
  question
}
alias -l question {
  msg %trivia.chan Category: %trivia.cat - Question: %trivia.ques
  timerhint1 1 10 hint
}

alias -l hint {
  set %hint1 Ah come on! @ Still don't know it? @ Go study! @ Here's a hint.
  msg %trivia.chan $gettok(%hint1,$r(1,4),64) $+ : %trivia.hint1
  timerhint2 1 10 hint2
}
alias -l hint2 {
  set %hint2 You really need to study. @ Pff... @ There's something called 'school', ever heard of it? @ Try this.
  msg %trivia.chan $gettok(%hint2,$r(1,4),64) - Hint: %trivia.hint2
  timerhint2 1 10 answer
}
alias -l answer {
  set %answer Guess it's just too hard. @ Whatever... @ I'll give you the answer. @ Nobody said the correct answer within 30 seconds.
  msg %trivia.chan $gettok(%answer,$r(1,4),64) - Answer: %trivia.ans
}