Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Currency Converter by Ford_Lawnmower irc.geekshed.net #Script-Help
- ;Requested by RicJames
- alias -l Settings {
- ;Edit the return lines below to change the colors.
- goto $prop
- :ColorFrom
- return $+($chr(3),04)
- :ColorTo
- return $+($chr(3),07)
- :Color=
- return $+($chr(15))
- }
- menu Channel,Status {
- .$iif($group(#CurrencyConverter) == On,$style(1)) CurrencyConverter Trigger
- ..$iif($group(#CurrencyConverter) == On,$style(2)) On: .enable #CurrencyConverter
- ..$iif($group(#CurrencyConverter) == Off,$style(2)) Off: .disable #CurrencyConverter
- }
- #CurrencyConverter On
- On $*:Text:/^(\+|-|!|@)Conv(ert)?.*/Si:#: {
- var %action $regml(1)
- if (%action isin +-) && ($regex($nick($chan,$nick).pnick,/(!|~|&|@)/)) {
- if (%action == +) {
- if ($istok(%CurrencyConverterChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is already running the CurrencyConverter script }
- else {
- .enable #CurrencyConverter
- Set %CurrencyConverterChanList $addtok(%CurrencyConverterChanList,$+($network,$chan),32)
- .msg $chan $nick has activated the CurrencyConverter script for $chan .
- }
- }
- else {
- if (!$istok(%CurrencyConverterChanList,$+($network,$chan),32)) { .msg $chan $nick $chan is not running the CurrencyConverter script }
- else {
- Set %CurrencyConverterChanList $remtok(%CurrencyConverterChanList,$+($network,$chan),1,32)
- .msg $chan $nick has deactivated the CurrencyConverter script for $chan .
- }
- }
- }
- elseif (!$timer($+(CurrencyConverter,$network,$nick))) && ($istok(%CurrencyConverterChanList,$+($network,$chan),32)) {
- .timer $+ $+(CurrencyConverter,$network,$nick) 1 6 noop
- var %method $iif(%action == !,.notice $nick,$iif($regex($nick($chan,$nick).pnick,/(!|~|&|@|%|\+)/),.msg $chan,.notice $nick))
- GetCurrencyConverter %method $strip($2-)
- }
- }
- #CurrencyConverter end
- alias Currency { GetCurrencyConverter echo -a $1- }
- alias -l GetCurrencyConverter {
- $1-2 Searching........
- var %sockname $+(CurrencyConverter,$network,$2,$ticks)
- sockopen %sockname google.com 80
- sockmark %sockname $1-2 $+(/ig/calculator?hl=en&q=,$3,$upper($4),%,3D,%,3F,$upper($5))
- }
- On *:sockopen:CurrencyConverter*: {
- if (!$sockerr) {
- sockwrite -nt $sockname GET $gettok($sock($sockname).mark,3,32) HTTP/1.0
- sockwrite -n $sockname Host: www.google.com
- sockwrite -n $sockname $crlf
- }
- else { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
- }
- On *:sockread:CurrencyConverter*: {
- if ($sockerr) { echo -st Socket Error $nopath($script) | sockclose $sockname | return }
- else {
- sockread -f &CurrencyConverter
- if ($regex($bvar(&CurrencyConverter,1-).text,/lhs:\s"(.*)"\x2crhs:\s"(.*?)"\x2cerror:/i)) {
- if ($regml(1)) $gettok($sock($sockname).mark,1-2,32) $replace($+($Settings().ColorFrom,$regml(1),$Settings().Color=,$chr(32),=,$chr(32),$Settings().ColorTo,$regml(2)),$chr(160),$chr(44))
- else $gettok($sock($sockname).mark,1-2,32) $Settings().ColorFrom Unable to complete conversion, please check your syntax. $Settings().Color= ie.$&
- $Settings().ColorTo !Convert VALUE CurrencyFrom CurrencyTo
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement