All pastes #411561 Raw Edit

Unnamed

public text v1 · immutable
#411561 ·published 2007-03-27 03:06 UTC
rendered paste body
on $*:TEXT:/^[!@](quest|idlequest)/Si:#:{
  .set %quest.way $iif($left($1,1) == @,.msg $chan,.notice $nick)
  .sockopen QUEST pure.nullrouted.biz 80
}
on *:SOCKOPEN:QUEST: {
  sockwrite -nt $sockname GET /~xnemesis/quest.php
  sockwrite -nt $sockname Host: pure.nullrouted.biz
  sockwrite -nt $sockname $crlf $crlf 
}
on *:SOCKREAD:QUEST: {
  if ($sockerr) { echo -at ** Error ** in socket: $sockerr | halt } 
  else { 
    var %questit 
    sockread %questit
    if (*<p>Sorry, there is no active quest.</p>* iswm %questit) {
      %quest.way $c1(Sorry, there is no active quest for the) $c2(SuperIRC) $c1(network.)
      unset %quest.*
      set %quest.wrong 1
      halt
    }
    if (*<p><b>Quest:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.info $nohtml($2-)
    }
    if (*p><b>Participant 1:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.par1 $nohtml($3-)
    }
    if (*p><b>Participant 2:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.par2 $nohtml($3-)
    }
    if (*p><b>Participant 3:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.par3 $nohtml($3-)
    }
    if (*p><b>Participant 4:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.par4 $nohtml($3-)
    }
    if (*<b>Position:</b>* iswm %questit) {
      tokenize 32 %questit
      if (!%quest.po1) set %quest.po1 $nohtml($2)
      elseif (!%quest.po2) set %quest.po2 $nohtml($2)
      elseif (!%quest.po3) set %quest.po3 $nohtml($2)
      elseif (!%quest.po4) set %quest.po4 $nohtml($2)
    }
    if (*<p><b>Current Goal:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.goal $nohtml($3-)
    }
    if (*<p><b>Time to completion:</b>* iswm %questit) {
      tokenize 32 %questit
      set %quest.goal $remove($nohtml($3-),completion:)
    }
  }
}
on *:SOCKCLOSE:QUEST: {
  if ($var(%quest.wrong)) {
    unset %quest.wrong | halt
  }
  else {
    %quest.way $c2(Current Quest Info:) $c1(%quest.info)
    %quest.way $c2(Quest Goal:) $c1(%quest.goal)
    %quest.way $c2(Participant's: 1:) $c1(%quest.par1) $iif(%quest.po1 != $null,$c2(Position:) $c1(%quest.po1)) $c2(2:) $c1(%quest.par2) $iif(%quest.po2 != $null,$c2(Position:) $c1(%quest.po2)) $c2(3:) $c1(%quest.par3) $iif(%quest.po3 != $null,$c2(Position:) $c1(%quest.po3)) $c2(4:) $c1(%quest.par4) $iif(%quest.po4 != $null,$c2(Position:) $c1(%quest.po4))
  }
  unset %quest.*
}