• Log in or sign up for an account here: https://www.sythe.org/login

Translator Snippet mSL

Jordyboy

Active Member

Banned
Joined
Aug 15, 2007
Sythe Gold
0
Messages
163
Location
Birmingham, UK.
Usefull if you're going to need to translate, Nice bit of mSL anyway it was one of my first few scripts.

Code:
;; Translator Dialog Made By Jordyboy ;;
menu channel { 
  Translator:/dialog -ma Translater_Dialog Translater_dialog 
} 
on *:DIALOG:Translater_dialog:sclick:4,1:{ 
  if ($did == 4) { /set %translate-from $did(4).seltext } 
  if ($did == 1) { /set %translate-too $did(1).seltext  } 
} 

on *:DIALOG:Translater_dialog:init:*:{ 
  /did -a Translater_dialog 4 French 
  /did -a Translater_dialog 4 Spanish 
  /did -a Translater_dialog 4 German 
  /did -a Translater_dialog 4 Italian 
  /did -a Translater_dialog 4 English 
  /did -a Translater_dialog 1 French 
  /did -a Translater_dialog 1 Spanish 
  /did -a Translater_dialog 1 German 
  /did -a Translater_dialog 1 Italian 
  /did -a Translater_dialog 1 English 
} 

alias translate { /dialog -ma Translater_dialog Translater_dialog } 

on *:DIALOG:Translater_dialog:edit:8:{ /set %translate-text $replace($did(8),$chr(32),$+(%,2,0)) } 

on *:DIALOG:Translater_dialog:close:*:{ translate-text } 

dialog Translater_dialog { 
  title "Translater_dialog" 
  size -1 -1 188 141 
  option dbu 
  list 1, 124 28 50 50, sort size 
  button "Translate", 2, 12 123 78 12, ok 
  button "Cancel", 3, 99 123 75 12, cancel 
  list 4, 58 28 50 50, sort size 
  text "Translate from?", 5, 60 19 45 8 
  text "Translate too?", 6, 128 20 42 8 
  box "Translator", 7, 5 5 181 133 
  edit "", 8, 36 97 50 10, autohs 
  box "Text To Translate", 9, 24 88 72 26 
  box "Languages", 10, 55 11 129 70 
  text "Welcome to the translater dialog please select a languge to translate from and a languge to translate too then enter your text to translate.", 11, 10 22 42 58 
} 

alias -l translate-text { 
  sockopen lang ets.freetranslation.com 80 
} 
on *:SOCKOPEN:lang:{ 
  sockwrite -n $sockname GET /?srcText= $+ %translate-text $+ &mode=html&template=results_en-us.htm&sequence=core&language= $+ %translate-from $+ $+(%,2,F) $+ %translate-too HTTP/1.1 
  sockwrite -n $sockname Host: ets.freetranslation.com $+ $crlf $+ $crlf 
} 
on *:SOCKREAD:lang:{ 
  if ($sockerr) { /echo -a Sorry $nick There was a problem connecting to the site, try again soon. | { /halt } } 
  else { 
    var %outcome-looks-? 
    sockread -f %outcome-looks-? 
    if (*textarea name="dsttext" cols="40" rows="6"* iswm %outcome-looks-?) { /dialog -ma Translater_Dialog_ Translater_Dialog_ | /did -a Translater_dialog_ 1 $html-just-ditch-it($remove(%outcome-looks-?,$chr(9))) | /unset %translate* %%outcome-looks-? | { /halt } } 
    if ($sockerr) { /echo -a Sorry $nick There was a problem connecting to the site, try again soon. } 
  } 
} 

alias -l html-just-ditch-it { 
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;) 
  return %x 
} 

dialog Translater_Dialog_ { 
  title "Translater Dialog" 
  size -1 -1 169 88 
  option dbu 
  text "Here is the translation.", 2, 17 16 144 16 
  box "Finished", 3, 8 5 157 79 
  button "Close", 4, 13 69 74 12, cancel 
  button "Translate something else", 5, 91 69 67 12, ok 
  combo 1, 18 34 132 34, size 
} 

on *:DIALOG:Translater_Dialog_:sclick:5:{ /.timer 1 1 /dialog -ma Translater_Dialog Translater_Dialog 
}

PLEASE DONT SAY L2SPELL >_<
I made this a few years ago.
 
Runescape Gamblingrunescape gambling
Back
Top