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
Phoenix
Newbie


Joined: 03 May 2002
Posts: 9

PostPosted: Fri May 03, 2002 1:59 am   

Zmud translator
 
Hi, on the mud I play there are several different languages, and I wanted to make a zmud trigger that translated from one to another.
The language base is simple, one character maps onto another.
For example, in Kzin:
evwxiyzbocdfghujklmnapqrst maps onto abcdefghijklmnopqrstuvwxyz... so I made a trigger to translate... it looked like this:

#TR {^(%w) tells you '(*)', in Kzin.} {#ECHO %1 is trying to say %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %lower( %remove( ,, %2)), t, Z), s, Y), r, X), q, W), p, V), a, U), n, T), m, S), l, R), k, Q), j, P), u, O), h, N), g, M), f, L), d, K), c, J), o, I), b, H), z, G), y, F), i, E), x, D), w, C), v, B), e, A)}

Now the problem I'm having is with commas. In theory, you shouldn't have to remove the commas, they shouldn't mess stuff up... but in practice it cuts off the string after the first comma. So I set it to remove the commas.... but it still doesn't work.

I'd appreciate any help you can give me!

Thanks
Reply with quote
Kjata
GURU


Joined: 10 Oct 2000
Posts: 4379
Location: USA

PostPosted: Fri May 03, 2002 2:16 am   
 
Try surrounding the %2 in double quotes.

Kjata
Reply with quote
Phoenix
Newbie


Joined: 03 May 2002
Posts: 9

PostPosted: Fri May 03, 2002 3:51 am   
 
I tried surrounding %2 in " ", in ' ', and leaving it without quotes. I also tried the same for that comma...no luck.

I think that its a bug in Zmud, but I'm not sure.
Reply with quote
Phoenix
Newbie


Joined: 03 May 2002
Posts: 9

PostPosted: Fri May 03, 2002 3:57 am   
 
I also tried using %replace instead of %remove (since %remove only does the first occurance, but %replace doesn't work well with commas)
Reply with quote
Phoenix
Newbie


Joined: 03 May 2002
Posts: 9

PostPosted: Fri May 03, 2002 4:05 am   
 
I sort of found a workaround.... if I use %concat it will remove the commas, solving the problem...only problem is if a person uses more than nine commas in a line (since concat only works to 9 parameters)...

Guess I'll do some more testing, and may file a bug report.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri May 03, 2002 6:00 am   
 
You could try %quote, don't know if it will work.

quote:
In theory, you shouldn't have to remove the commas, they shouldn't mess stuff up

Actually, zMUD functions use commas to delimit fields, so in theory they will mess stuff up.

LightBulb
Vague questions get vague answers
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Fri May 03, 2002 3:05 pm   
 
Without the remove, but WITH doublequotes it works fine for me:
#TRIGGER {^(%w) tells you '(*)', in Kzin.} {#ECHO %1 is trying to say %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %replace( %lower( "%2"), t, Z), s, Y), r, X), q, W), p, V), a, U), n, T), m, S), l, R), k, Q), j, P), u, O), h, N), g, M), f, L), d, K), c, J), o, I), b, H), z, G), y, F), i, E), x, D), w, C), v, B), e, A)}

Now
#SH "abc tells you 'evwxi, yzbo, cdf, gh ,, ujk, lmnapqrst', in Kzin."
outputs
abc is trying to say ABCDE, FGHI, JKL, MN ,, OPQ, RSTUVWXYZ
which looks ok to me.

If you're using the current beta version you can shorten it to:
#TRIGGER {^(%w) tells you '(*)', in Kzin.} {#ECHO %1 is trying to say %subchar( %lower( "%2"), "evwxiyzbocdfghujklmnapqrst", "ABCDEFGHIJKLMNOPQRSTUVWXYZ")}

PS.
Why do you think %concat() accepts only 9 parameters?
I've tried
#SH %concat(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,A,B,C,D,E)
with result:
abcdefghijklmnopqrstuvwxyz0123456789ABCDE
Reply with quote
dacheeba
Adept


Joined: 29 Oct 2001
Posts: 250

PostPosted: Fri May 03, 2002 5:00 pm   
 
quote:

PS.
Why do you think %concat() accepts only 9 parameters?
I've tried
#SH %concat(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z,0,1,2,3,4,5,6,7,8,9,A,B,C,D,E)
with result:
abcdefghijklmnopqrstuvwxyz0123456789ABCDE



Thats what it says in the help file.They really need updating
Reply with quote
Sildaren
Wanderer


Joined: 19 Jul 2001
Posts: 59
Location: Germany

PostPosted: Fri May 03, 2002 9:05 pm   
 
Help files?
Never heard of such a thing!
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: Mon May 27, 2002 4:26 am   
 
Well i might be a little late on this one, but here is a script for you to use. Note that the special chars won't work (like ;, @, etc) you can add other chars to the language codes, like other punctuation, but if they are the same in all, then make it in the same position in all... this script will work good because all you have to do is define a variable with the key, following the alphabet variable format and it will decypher:

#trigger {(%w) tells you '(*)' in (%w)} {#var whotold {%1};#var phrase {%2};#var language {@%3};translate;#say @whotold told me @translated in %3}
#alias {translate} {#var translated " ";#var alphabet "abcdefghijklmnopqrstuvwxyz,.! :";#var Kzin "evwxiyzbocdfghujklmnapqrst,.! :";#var other "qwertyuiopasdfghjklzxcvbnm,.! :";#var phrase {%lower( @phrase)};#var phraselen {%len( @phrase)};#var templen 1;#while (@templen < (@phraselen+1)) { #var findit {%copy( @phrase, ((@templen)), 1)}; #var letpos {%pos( @findit, @language)}; #var translated {@translated%copy( @alphabet, @letpos, 1)}; #add templen 1};#var translated {%trimleft( @translated)}}

Hope this helps you, sorry im late but i just subscribed to this forum!
Reply with quote
NiteTrip
Novice


Joined: 21 May 2002
Posts: 40
Location: Canada

PostPosted: Mon May 27, 2002 4:27 am   
 
Note that the above has two languages, Kzin and Other. you can put in all that you wish, just follow the same pattern
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