um just another way of making it using sockmark
i know it an be made better but w/e
on $*:text:/^@Currency/iS:#:{
if (!$hget(Currency,sets)) {
.hadd -mu4 Currency sets USD AUD CAD CHF CNY DKK EUR GBP HKD HUF INR JPY MXN MYR NOK NZD RUB SEK SGD THB ZAR
if ($2 isnum && $istok($hget(Currency,sets),$3,32) && $istok($hget(Currency,sets),$4,32) && !$5) {
if ($sock(Currency)) sockclose Currency
sockopen Currency www.xe.com 80
sockmark Currency $+(/ucc/convert.cgi?Amount=,$2,&From=,$3,&To=,$4) msg #
}
else { msg # $iif($2 !isnum || $5,Syntax: @currency amount from to EX: @currency 2 usd aud,please enter Currencys: $hget(Currency,sets)) }
}
}
on *:sockopen:Currency: {
sockwrite -nt $sockname GET $gettok($sock(Currency).mark,1,32) HTTP/1.1
sockwrite -nt $sockname Host: $+(www.xe.com,$str($crlf,2))
}
on *:sockread:Currency: {
var %Currency | sockread %Currency
if ($regex(%Currency,/<tr><td width=.+right.+>(.+)<.+WARNING:.+><\/h2><\/td>/)) { .hadd -mu4 Currency say $regml(1) }
if ($regex(%Currency,/<td width=.+left.+>(.+)<.+WARNING:.+><\/h2><\/td>/)) { $gettok($sock(Currency).mark,2-,32) $hget(Currency,say) = $regml(1) | sockclose Currency }
}