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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Jodokast
Newbie


Joined: 01 Jun 2003
Posts: 2

PostPosted: Sun Jun 01, 2003 11:46 pm   

Translator script?
 
Anyone know how to set up a script to "translate" something character by character? I'm trying to translate mud languages that use simple character substitution, I have the english-mudlanguage substitution charts, I just need to know how to set up triggers that will auto translate... example: I need to translate "Someone tells you 'fpol', in Dwarven." to "Someone tells you 'blah', in Dwarven." Any idea how to do this?
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 02, 2003 1:27 am   
 
One method.
#ADDK DtoH {f=b|p=l}
#ADDK DtoH {o=a|l=h}
#TR {tells you '(*)', in Dwarven} {#LOOP 1,%len( %1) {#SAYP %db( @DtoH, %copy( %1, %i, 1))};#CR}

LightBulb
Advanced Member
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Mon Jun 02, 2003 12:53 pm   
 
Take a look also at the %subchar function.

Kjata
Reply with quote
Tarn
GURU


Joined: 10 Oct 2000
Posts: 873
Location: USA

PostPosted: Mon Jun 02, 2003 6:12 pm   
 
quote:

Take a look also at the %subchar function.



Without zMud in front of me and the website help file not yet including %subchar, hopefully I won't say something stupid

If %subchar just substitutes one character for another, you've still got a problem if you try to apply substitutions in the most obvious way.

Example:
We've got a language with three letters
{a|b|c}
We want to translate to
{b|c|a}

Starting with the message "abc", we swap the "a" in the string "abc" out, winding up with "bbc". We then swap out the "b"'s to get "cca". Finally, we swap out the "c"'s to get our fully translated message, "aaa".

Oops

You COULD use this call with dummy characters that aren't actually in the message alphabet to avoid a looping structure in the script. Speed trials might be necessary to decide which was better, though.

-Tarn
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Jun 02, 2003 7:15 pm   
 
Actually, the %subchar function originally did have that problem. However, Zugg has modified it so that it only changes each character once. I wish I'd thought of it when I responded the first time, it's much simpler than #LOOP.

You could put the strings directly in the trigger, but variables will be easier to update. They don't have to be in any particular order as long as they match each other. That is, the "f" should be in the same place in the first string as the "b" in the second string.

#VAR DwarfAlpha {oflp}
#VAR HumanAlpha {abhl}
#TR {tells you '(*)', in Dwarven} {#SAY He said, '%subchar( "%1", @DwarfAlpha, @HumanAlpha)'}

LightBulb
Advanced Member
Reply with quote
Jodokast
Newbie


Joined: 01 Jun 2003
Posts: 2

PostPosted: Tue Jun 03, 2003 11:12 pm   
 
Thanks for your help- works wonderfully ;) Now I just have to go about getting the translations for the rest of the languages on my mud :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD General Discussion 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