Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » Finished MUD Scripts
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Tue Jul 08, 2008 3:24 pm   

Zmud Translator
 
A little and quick translator I made using zmud.

//
Zmud Translator
-Made by Illyism; Illyism@hotmail.com
With a lot of help from Zuggsoft and Dharkael

Commands:
Chooselans ::Pick languages, 1. source, 2.target
trans <word> ::translates the word
Transhelp ::Shows this text
//

The full code:
Quote:
#CLASS {translator}
#ALIAS trans {
#var wordtrans %1
transObj.Word = %1
#call @transObj.Translate()
#wa 500
#gagon
#show %ansi( black)@transObj.Result
#gagoff
#echo %ansi( green)@trans
}
#ALIAS TransHelp {
#show %ansi( green)Zmud Translator
#show %ansi( red)--Made by Illyism~; %ansi( blue)Illyism@hotmail.com
#say With a lot of help from Zuggsoft and Dharkael
#say
#say
#say
#show %ansi( yellow)Commands:
#show %ansi( green)Chooselans %ansi( white)Pick languages, 1. source, 2.target
#show %ansi( green)trans %ansi( yellow)word %ansi( white) translates the word
#say
#cr
}
#ALIAS chooselans {
#pick {@placesorlans}
#pick {@placetarglans}
}
#ALIAS setarglans {#echo Target Language is : %1}
#ALIAS setsorlans {#echo Source Language is : %1}
#VAR translink {http://www.majstro.com/Web/Majstro/mobile_translator.php?bron=eng&doel=lat&wrd=reds}
#VAR trans { ?}
#VAR thetarglans {fao}
#VAR thesourcelans {eng}
#VAR placetarglans {p:Select the Target Language:|setarglans 'afr'Afrikaans|setarglans 'alb'Albanian|setarglans 'cat'Catalan|setarglans 'ces'Czech|setarglans 'dan'Danish|setarglans 'dut'Dutch|setarglans 'eng'English|setarglans 'ang'English(OldEnglish)|setarglans 'epo'Esperanto|setarglans 'fao'Faeroese|setarglans 'fin'Finnish|setarglans 'fra'French|setarglans 'fry'Frisian|setarglans 'deu'German|setarglans 'ell'Greek|setarglans 'hun'Hungarian|setarglans 'ice'Icelandic|setarglans 'ita'Italian|setarglans 'jpn'Japanese|setarglans 'lat'Latin|setarglans 'may'Malay|setarglans 'nor'Norwegian|setarglans 'pap'Papiamento|setarglans 'pol'Polish|setarglans 'por'Portuguese|setarglans 'rom'Romanian|setarglans 'rus'Russian|setarglans 'gae'ScottishGaelic|setarglans 'spa'Spanish|setarglans 'sra'Sranan|setarglans 'swa'Swahili|setarglans 'sve'Swedish|setarglans 'tgl'Tagalog|setarglans 'tai'Thai|setarglans 'tur'Turkish|setarglans 'yuc'Yucatec|setarglans 'zul''Zulu}
#VAR transed {fish: pÍcher, poisson}
#VAR transObj {<OLE object: illyism.translator.WSC>}
#VAR wordtrans {}
#VAR placesorlans {p:Select the Source Language:|setsorlans 'afr'Afrikaans|setsorlans 'alb'Albanian|setsorlans 'cat'Catalan|setsorlans 'ces'Czech|setsorlans 'dan'Danish|setsorlans 'dut'Dutch|setsorlans 'eng'English|setsorlans 'ang'English(OldEnglish)|setsorlans 'epo'Esperanto|setsorlans 'fao'Faeroese|setsorlans 'fin'Finnish|setsorlans 'fra'French|setsorlans 'fry'Frisian|setsorlans 'deu'German|setsorlans 'ell'Greek|setsorlans 'hun'Hungarian|setsorlans 'ice'Icelandic|setsorlans 'ita'Italian|setsorlans 'jpn'Japanese|setsorlans 'lat'Latin|setsorlans 'may'Malay|setsorlans 'nor'Norwegian|setsorlans 'pap'Papiamento|setsorlans 'pol'Polish|setsorlans 'por'Portuguese|setsorlans 'rom'Romanian|setsorlans 'rus'Russian|setsorlans 'gae'ScottishGaelic|setsorlans 'spa'Spanish|setsorlans 'sra'Sranan|setsorlans 'swa'Swahili|setsorlans 'sve'Swedish|setsorlans 'tgl'Tagalog|setsorlans 'tai'Thai|setsorlans 'tur'Turkish|setsorlans 'yuc'Yucatec|setsorlans 'zul''Zulu}
#TRIGGER {Target Language is%s:%s~'(%w)~'*} {
#var thetarglans %1
transObj.Target = @thetarglans
}
#TRIGGER {Source Language is%s:%s~'(%w)~'*} {
#var thesourcelans %1
transObj.Source = @thesourcelans
}
#TRIGGER {div(*)/div} {
#var trans %line
#var trans %replace( @trans, "<br/>", ";#show")
#var trans %replace( @trans, "</div>", "")
#var trans %replace( @trans, "<div>", "")
#var trans %replace( @trans, "div", "")
#var trans %replace( @trans, "br", "")
#var trans %replace( @trans, "/", "")
#var trans %replace( @trans, ";", ",")
}
#CLASS 0
#ALIAS atconnect {#var transObj %comcreate( "illyism.translator.WSC")} "System"
#var transObj %comcreate( "illyism.translator.WSC")


The recommended import version
Code:
#CLASS {translator}
#ALIAS trans {#var wordtrans %1;transObj.Word = %1;#call @transObj.Translate();#wa 500;#gagon;#show %ansi( black)@transObj.Result;#gagoff;#echo %ansi( green)@trans}
#ALIAS TransHelp {#show %ansi( green)Zmud Translator;#show %ansi( red)--Made by Illyism~; %ansi( blue)Illyism@hotmail.com;#say With a lot of help from Zuggsoft and Dharkael;#say;#say;#say;#show %ansi( yellow)Commands:;#show %ansi( green)Chooselans %ansi( white)Pick languages, 1. source, 2.target;#show %ansi( green)trans %ansi( yellow)word %ansi( white) translates the word;#say;#cr}
#ALIAS chooselans {#pick {@placesorlans};#pick {@placetarglans}}
#ALIAS setarglans {#echo Target Language is : %1}
#ALIAS setsorlans {#echo Source Language is : %1}
#VAR translink {http://www.majstro.com/Web/Majstro/mobile_translator.php?bron=eng&doel=lat&wrd=reds}
#VAR trans {      ?}
#VAR thetarglans {fao}
#VAR thesourcelans {eng}
#VAR placetarglans {p:Select the Target Language:|setarglans 'afr'Afrikaans|setarglans 'alb'Albanian|setarglans 'cat'Catalan|setarglans 'ces'Czech|setarglans 'dan'Danish|setarglans 'dut'Dutch|setarglans 'eng'English|setarglans 'ang'English(OldEnglish)|setarglans 'epo'Esperanto|setarglans 'fao'Faeroese|setarglans 'fin'Finnish|setarglans 'fra'French|setarglans 'fry'Frisian|setarglans 'deu'German|setarglans 'ell'Greek|setarglans 'hun'Hungarian|setarglans 'ice'Icelandic|setarglans 'ita'Italian|setarglans 'jpn'Japanese|setarglans 'lat'Latin|setarglans 'may'Malay|setarglans 'nor'Norwegian|setarglans 'pap'Papiamento|setarglans 'pol'Polish|setarglans 'por'Portuguese|setarglans 'rom'Romanian|setarglans 'rus'Russian|setarglans 'gae'ScottishGaelic|setarglans 'spa'Spanish|setarglans 'sra'Sranan|setarglans 'swa'Swahili|setarglans 'sve'Swedish|setarglans 'tgl'Tagalog|setarglans 'tai'Thai|setarglans 'tur'Turkish|setarglans 'yuc'Yucatec|setarglans 'zul''Zulu}
#VAR transed {fish: pÍcher, poisson}
#VAR transObj {<OLE object: illyism.translator.WSC>}
#VAR wordtrans {}
#VAR placesorlans {p:Select the Source Language:|setsorlans 'afr'Afrikaans|setsorlans 'alb'Albanian|setsorlans 'cat'Catalan|setsorlans 'ces'Czech|setsorlans 'dan'Danish|setsorlans 'dut'Dutch|setsorlans 'eng'English|setsorlans 'ang'English(OldEnglish)|setsorlans 'epo'Esperanto|setsorlans 'fao'Faeroese|setsorlans 'fin'Finnish|setsorlans 'fra'French|setsorlans 'fry'Frisian|setsorlans 'deu'German|setsorlans 'ell'Greek|setsorlans 'hun'Hungarian|setsorlans 'ice'Icelandic|setsorlans 'ita'Italian|setsorlans 'jpn'Japanese|setsorlans 'lat'Latin|setsorlans 'may'Malay|setsorlans 'nor'Norwegian|setsorlans 'pap'Papiamento|setsorlans 'pol'Polish|setsorlans 'por'Portuguese|setsorlans 'rom'Romanian|setsorlans 'rus'Russian|setsorlans 'gae'ScottishGaelic|setsorlans 'spa'Spanish|setsorlans 'sra'Sranan|setsorlans 'swa'Swahili|setsorlans 'sve'Swedish|setsorlans 'tgl'Tagalog|setsorlans 'tai'Thai|setsorlans 'tur'Turkish|setsorlans 'yuc'Yucatec|setsorlans 'zul''Zulu}
#TRIGGER {Target Language is%s:%s~'(%w)~'*} {#var thetarglans %1;transObj.Target = @thetarglans}
#TRIGGER {Source Language is%s:%s~'(%w)~'*} {#var thesourcelans %1;transObj.Source = @thesourcelans}
#TRIGGER {div(*)/div} {#var trans %line;#var trans %replace( @trans, "<br/>", ";#show");#var trans %replace( @trans, "</div>", "");#var trans %replace( @trans, "<div>", "");#var trans %replace( @trans, "div", "");#var trans %replace( @trans, "br", "");#var trans %replace( @trans, "/", "");#var trans %replace( @trans, ";", ",")}
#CLASS 0
#ALIAS atconnect {#var transObj %comcreate( "illyism.translator.WSC")} "System"
#var transObj %comcreate( "illyism.translator.WSC")

Note: note tha ATCONNECT alias.

Dharkael's part
"You copy this code to a (text) file, save it with the file Extension WSC
I called mine Illyism.translator.WSC
then right click and register the file, it's now a COM component. "

Code:
<?xml version="1.0" ?>
<package>
   <comment>
        illyism's translator component
   </comment>
   <component >
      <?component error="true" debug="true" ?>
      <registration progid="illyism.translator.WSC" classid="{91F4A4A5-F8E1-47c4-86E2-AE784FEDA37C}" description="Illyism's translator component" version="1.0">
      </registration>
      <object id="conn" progid="MSXML2.XMLHTTP" events="true"/>   
      <public>
         <property name="Target">
            <get internalName="get_Target"/>
            <put internalName="put_Target"/>
         </property>
         <property name="Source">
            <get internalName="get_Source"/>
            <put internalName="put_Source"/>
         </property>
         <property name="Word">
            <get internalName="get_Word"/>
            <put internalName="put_Word"/>
         </property>
         <property name="Completed">
            <get internalName="is_Completed"/>           
         </property>
         <property name="Result">
            <get internalName="get_Result"/>           
         </property>                   
         <method name="Translate">       
        </method>
      </public>     
      <script language="JScript">
<![CDATA[
var Source = "eng";
var Target = "fra";
var Word ="";
var Complete = false;
var Result =""

function get_Target()
{
   return Target;
}
function put_Target(tar)
{
 Target = ""+tar;
}


function get_Source()
{
   return Source;
}
function put_Source(so)
{
 Source = ""+so;
}

function get_Word()
{
   return Word;
}
function put_Word(wo)
{
 Word = ""+wo;
}

function is_Completed()
{
   return Complete;
}

function get_Result()
{
   return Result;
}




function HandleStateChange()

{
  if (conn.readyState == 4)
  {
     Result = conn.responseText;     
     Complete=true;
  }
}


function Translate()
{
   Complete = false;
   Result="";
   if(conn.readyState!=0)
      conn.abort();
   conn.open("GET","http://www.majstro.com/Web/Majstro/mobile_translator.php?bron="+Source+"&doel="+Target+"&wrd="+Word,true)
   conn.onreadystatechange = HandleStateChange;
   conn.send();
}


]]>
      </script>
   </component>
</package>


Last edited by illyism on Fri Jul 18, 2008 4:07 pm; edited 1 time in total
Reply with quote
charneus
Wizard


Joined: 19 Jun 2005
Posts: 1876
Location: California

PostPosted: Fri Jul 18, 2008 1:40 pm   
 
1. Now if you can get it to work for CMUD...
2. On second thought, doesn't even really seem to work in zMUD... not sure what's going on, either. *shrug*

Charneus
Reply with quote
illyism
Wanderer


Joined: 09 Dec 2007
Posts: 58

PostPosted: Fri Jul 18, 2008 4:10 pm   
 
Quote:
2. On second thought, doesn't even really seem to work in zMUD... not sure what's going on, either. *shrug*

yes, my little fault, updated.

Quote:
1. Now if you can get it to work for CMUD...

not unless I get free cmud.
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » Finished MUD Scripts All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net