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
einar
Wanderer


Joined: 06 Nov 2000
Posts: 80
Location: USA

PostPosted: Mon Feb 21, 2005 7:10 am   

Character conversion script
 
Ok, I've been trying to make a script to convert a language on my MUD.
The conversion just replaces 1 letter with the opposite:
Code:
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


I just have no idea on how to do this? I've considered #SUB, %subchar, and a whole bunch of others, but I just can't seem to figure out how to swap half the letters with the other half and vice versa :P

Anyone have ideas on how to do this? I hope to be able to read whole paragraphs (or bare minimum, word by word) with this.
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Mon Feb 21, 2005 9:24 am   
 
You can use subchar for this fairly easily.

#TR {(*)} {#SUB {%subchar(%1, "ABCDEFGHIJKLMNOPQRSTUVWXYZ", "NOPQRSTUVWXYZABCDEFGHIJKLM")}}


This will switch A for N, B for O, C for P, etc. and vice versa. You can modify this, I'm sure, for what you need.
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
Aarlot
Adept


Joined: 30 Dec 2003
Posts: 226

PostPosted: Mon Feb 21, 2005 9:28 am   
 
Though, I think subchar is case dependent as well... so you'd have to do something like this if you wanted upper and lower case changed the same way:

#TR {(*)} {#SUB {%subchar(%1, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm")}}
_________________
Everyone is entitled to their beliefs - until they die. Then only the truth matters.
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Mon Feb 21, 2005 9:37 am   
 
I think the decoder ring script in the finished scripts forum does exactly this.
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