mIRC Home    About    Download    Register    News    Help

Print Thread
#134710 04/11/05 03:52 AM
Joined: Oct 2005
Posts: 17
C
cashed Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2005
Posts: 17
is there code for a currency converter
?

#134711 04/11/05 03:57 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I'm not aware of one, I don't need to convert currencies while chatting in mIRC very often. When I do, I simply go to Currency Converter and fill in the information manually. Someone more knowledgeable about sockets might be able to write a script for this.

#134712 04/11/05 05:17 AM
Joined: Feb 2005
Posts: 342
R
Fjord artisan
Offline
Fjord artisan
R
Joined: Feb 2005
Posts: 342
I haven't personally tried this myself, but: Currency Conversion Script

If you're wanting to find other "scripts" as well, you can always use the Search Function on mircscripts.org. They have a pretty large selection to browse through.

Last edited by Rand; 04/11/05 05:24 AM.
#134713 04/11/05 07:29 AM
Joined: Oct 2005
Posts: 17
C
cashed Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2005
Posts: 17
well this is what i got so far.



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 }
}




But all it displays in channel is Currently busy. Please be patient.

Last edited by cashed; 04/11/05 07:31 AM.
#134714 05/11/05 01:12 AM
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Please use the Code Tags when posting code.

Try using this slightly altered version of your code.
Code:
 on *:TEXT:!conv*:#: { 
  if ($2-$4) { 
    if ($remove($2,$chr(44)) isnum) { 
      if ($3 isin %convert.currency &amp;&amp; $4 isin %convert.currency) { 
        if !%conv.busy { 
          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 $+ &lt;/span&gt;&lt;br&gt; isin %tmp) {
    msg %conv.chan Converted amount of: %conv.amount $upper(%conv.from) = $gettok($gettok(%tmp,3,32),2,62) $upper(%conv.to) $+ .
  } 
  if (&lt;/html&gt; isin %tmp) {
    sockclose $sockname
  } 
} 
on *:sockclose:Converter:{
  unset %conv.busy
}
 

#134715 05/11/05 03:15 AM
Joined: Oct 2005
Posts: 17
C
cashed Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2005
Posts: 17
sorry about that



heres what it says now useing the altered code you posted






<cashed> !conv 25 CAD USD
[22:12] <TL-Info> Converting 25 CAD to USD. set #area51 set cashed set 25 set CAD set USD set 1 sockopen Converter xe.com 80

#134716 05/11/05 11:17 PM
Joined: Oct 2005
Posts: 17
C
cashed Offline OP
Pikka bird
OP Offline
Pikka bird
C
Joined: Oct 2005
Posts: 17
Any One Have A Suggestion???????

#134717 06/11/05 02:10 PM
Joined: Apr 2003
Posts: 701
K
Hoopy frood
Offline
Hoopy frood
K
Joined: Apr 2003
Posts: 701
You do have that code in Remotes just the way it looks here? If it's all on one line it's wrong. Try pasting it in notepad first and then copy it again and paste it in remotes.


Link Copied to Clipboard