This script converts 1 currency to another.
Easy usage: !conv [amount] [cur1] [cur2]
Example: !conv 1000 EUR USD <-- Will convert a thousand Euro's to US Dollars.
;Place this line in Variables:
; %convert.currency AUD CAD CHF CNY DKK EUR GBP HKD HUF INR JPY MXN MYR NOK NZB RUB SEK SGD THB USD ZAR ZMK XPT XPD SDR XCD XAU XAG VEB TWD TTD TRL SKK SDD SAR RUR ROL PLN PKR PHP NZD LBP KRW JOD JMD ISK ILS IDR FJD EGP DZD CZK CYP BSD BRL BMD BGN BBD ARS
;Have fun!
on *:TEXT:!conv*:#: {
if ($2 && $3 && $4) {
if ($remove($2,$chr(44)) isnum) {
if ($3 isin %convert.currency && $4 isin %convert.currency) {
if (%conv.busy == 0) {
msg $chan Converting $2 $3 to $4 $+ .
set %conv.chan $chan
set %conv.nick $nick
set %conv.amount $remove($2,$chr(44))
set %conv.from $3
set %conv.to $4
set %conv.busy 1
sockopen Converter xe.com 80
}
else { msg $chan Currently busy. Please be patient. }
}
else { msg $chan Error! Not a valid currency! (Allowed: %convert.currency $+ ) }
}
else { msg $chan Error! $2 isn't a valid number! }
}
else { msg $chan Error! Missing an input. }
}
on *:SOCKOPEN:Converter:{
set %conv.submit $+(Amount=,%conv.amount,$chr(38),From=,%conv.from,$chr(38),To=,%conv.to,$chr(38),Submit=Submit)
sockwrite -n $sockname POST /ucc/convert.cgi HTTP/1.1
sockwrite -n $sockname Host: www.xe.com
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $calc($len(%conv.submit) + 1)
sockwrite -n $sockname
sockwrite -n $sockname %conv.submit
}
on *:SOCKREAD:Converter:{
var %tmp
sockread %tmp
;echo 4 -ag %tmp
if (%conv.to $+ </span><br> isin %tmp) { msg %conv.chan Converted amount of: %conv.amount $upper(%conv.from) = $gettok($gettok(%tmp,3,32),2,62) $upper(%conv.to) $+ . }
if (</html> isin %tmp) { set %conv.busy 0 | sockclose $sockname }
}