All pastes #101029 Raw Edit

Miscellany

public text v1 · immutable
#101029 ·published 2006-07-26 17:19 UTC
rendered paste body
alias -l randomcat {
  var %cats = $findfile(trivcat,*.txt,0)
  var %i = $r(1,%cats)
  return $remove($findfile(trivcat,*.txt,%i),$mircdir)
}
alias -l getq {
  var %cat = $iif(%triv.cat. [ $+ [ $1 ] ] == $null,$randomcat,%triv.cat. [ $+ [ $1 ] ])
  return $read(%cat)
}
alias -l ask {
  set %triv.l. [ $+ [ $1 ] ] $getq($1)
  set %triv.q. [ $+ [ $1 ] ] $gettok(%triv.l. [ $+ [ $1 ] ],1,124)
  set %triv.a. [ $+ [ $1 ] ] $gettok(%triv.l. [ $+ [ $1 ] ],2,124)
  msg $1 [TRIVIA QUESTION] %triv.q. [ $+ [ $1 ] ]
}
on *:TEXT:!trivia*:#:{
  if ($2) || $findfile(trivcat,$2 $+ .txt,1) != $null) {
    set %triv.cat. [ $+ [ $chan ] ] $remove($findfile(trivcat,$2 $+ .txt,1) == $null),$mircdir)
  }
  ask $chan
}