rendered paste bodyon $*:TEXT:/^[!@](quest|idlequest):#:{
.set %quest.way $iif($left($1,1) == @,.msg $chan,.notice $nick)
.sockopen QUEST www.xnemesis.net 80
}
on *:SOCKOPEN:QUEST: {
sockwrite -nt $sockname GET /superirc/irpg/quest.php
sockwrite -nt $sockname Host: www.xnemesis.net
sockwrite -nt $sockname $crlf $crlf
}
on *:SOCKREAD:QUEST: {
if ($sockerr) { echo -at ** Error ** in scoket: $sockerr | halt }
else {
var %questit
sockread %questit
if (*<p>Sorry, there is no active quest.</p>* iswm %questit) { %quest.way Sorry, there is no active quest. | 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($2-) }
if (*p><b>Participant 2:</b>* iswm %questit) { tokenize 32 %questit | set %quest.par2 $nohtml($2-) }
if (*p><b>Participant 3:</b>* iswm %questit) { tokenize 32 %questit | set %quest.par3 $nohtml($2-) }
if (*p><b>Participant 4:</b>* iswm %questit) { tokenize 32 %questit | set %quest.par4 $nohtml($2-) }
if (*<p><b>Current goal:</b>* iswm %questit) { tokenize 32 %questit | set %quest.goal $nohtml($2-) }
}
}
on *:SOCKCLOSE:QUEST: {
if ($var(%quest.wrong)) {
unset %quest.wrong | halt
}
else {
%quest.way $c2(Current Quest Info:) $c1(%quest.info)
%quest.goal $c2(Quest Goal:) $c1(%quest.goal)
%quest.way $c2(Participant's:) $c1(1: %quest.par1 2: %quest.par2 3: %quest.par3 4: %quest.par4)
}
unset %quest.*
}
alias nohtml { var %x,%i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x) | %x = $replace(%x, ,$null) | return %x }
alias c1 { return $+($chr(3),03,$1-) }
alias c2 { return $+($chr(3),15,$1-) }