norwegian translate snippets

By henrikthesexy on Jul 12, 2005

Translate Script:
-This script returns a norwegian -> english word from http://www.ordbok.no/
-To use type: !translate in a channel where a client got this script loaded.

To load put translate.mrc in your mirc folder and write in mIRC: /load -rs translate.mrc

alias htmlfree { var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $replace($remove(%x,&nbsp;,$chr(9)),gt;,>,$chr(35) $+ 39;,') | return %x }
on *:text:!translate*:#:{
  if ($1 == !translate) && (!%translate) {
    if ($2 == NO-NO) || ($2 == NO-UK) || ($2 == NO-DE) || ($2 == UK-NO) || ($2 == UK-FR) || ($2 == UK-ES) || ($2 == UK-SE) || ($2 == SE-UK) || ($2 == DE-NO) || ($2 == FR-UK) || ($2 == ES-UK) && ($3) { 
      set -u10 %translate $chan $replace($remove($2,-),SE,SV) $+ MX&word= $+ $3
      if ($sock(translate.info)) { .sockclose translate.info }
      .sockopen translate.info 66.70.46.80 5555
    }
    else { 
      set -u2 %translate 1
      .msg $chan [Translate] Syntax: !Translate <NO-NO/NO-UK/NO-DE/UK-NO/UK-FR/UK-ES/UK-SE/SE-UK/DE-NO/FR-UK/ES-UK> <word> 
    }
  }
}
on *:sockopen:translate.info:{ 
  if ($sockerr > 0) { return }
  else {
    sockwrite -n $sockname GET /?lang=us&dict= $+ $gettok(%translate,2,32) HTTP/1.1
    sockwrite -n $sockname Host: http://66.70.46.80
    sockwrite -n $sockname user-agent: Mozilla/??
    sockwrite -n $sockname Connection: Keep-Alive
    sockwrite -n $sockname $crlf
    set -u10 %translate $gettok(%translate,1,32)
  }
  else { .msg $gettok(%translate,2,32) [Translate] http://www.ordbok.no/ is currently down }
}
on *:sockread:translate.info:{
  if ($sockerr > 0) { return }
  :nextread
  sockread %translate.info
  if ($sockbr == 0) { return }
  if (%translate.info == $null) { %translate.info = - }
  if (%translate.var) { 
    var %translate.info = $replace($htmlfree(%translate.info),$chr(44),$chr(32) -)
    .msg %translate [Translate] $iif($len($gettok(%translate.info,2,32)) == 1,$gettok(%translate.info,1,32),%translate.info)
    .sockclose $sockname
    unset %translate.*
    return
  }
  if (*<font color="#157416">* iswm %translate.info) { set %translate.var 1 }
  if (*Word not found!<br><br>* iswm %translate.info) { 
    .msg %translate [Translate] Word not found.
    .sockclose $sockname
    unset %translate.*
    return
  }
  goto nextread 

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.