mIRC Trivia Auto Answer

Trivia Auto Answer

alias trivia {
  if ($1 == on) { set %trivia on | set %botnick $?="Bot's nick?" | echo -a Trivia ON | return }
  if ($1 == off) { set %trivia off | unset %botnick | echo -a Trivia OFF | return }
}
on *:TEXT:*:#:{
  if $nick == %botnick && %trivia == on {
    if ($strip($1-) isin $read(trivia.questions, w, * $+ $strip($1-))) {
      set %text $strip($1-)
      set %number $readn
      set %ftext $remove($read(trivia.questions, g, %number),| $+ %text)
    }
    if ($strip($1) == Hint:) { set %len $len($2-) | answer | return }
  }
}
alias answer {
  if (| isin %ftext) { goto end | halt | return }
  if (%len != $len($remove(%ftext,| $+ %text))) { goto end | halt | return }
  else {
    if ($len(%text) >= 70) { .timer 1 7 /msg # $lower(%ftext) | goto end | return }
    if ($len(%text) <= 70) { .timer 1 5 /msg # $lower(%ftext) | goto end | return }
  }
  :end
  unset %number %text %ftext %len
}