 |
einar Wanderer
Joined: 06 Nov 2000 Posts: 80 Location: USA
|
Posted: 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. |
|
|
 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: 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. |
|
|
 |
Aarlot Adept

Joined: 30 Dec 2003 Posts: 226
|
Posted: 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. |
|
|
 |
mr_kent Enchanter
Joined: 10 Oct 2000 Posts: 698
|
Posted: Mon Feb 21, 2005 9:37 am |
I think the decoder ring script in the finished scripts forum does exactly this.
|
|
|
 |
|
|