Join us in Phaze Demesnes

LSL Script Library Home   Add a script Show All
Category: Contributor: Description
Chat Renmiri Writer cypher / Al Bhed chat encryption
This little script will translate any text to Al Bhed and any Al Bhed text back to the original text.
Decoding and coding is done using only 6 lines of code so it is lightning fast, no lag involved and no large memory usage ^^.

Renmiri Writer


If you are having trouble,  I have it as a hud in slx for 1L  at http://www.xstreetsl.com/modules.php?name=Marketplace&file=item&ItemID=584135 
The Al Bhed language is a fictional language that is spoken only by the Al Bhed people on the video game Final Fantasy X .  The "Al Bhed language" is actually a simple substitution cipher, an encryption system of transposing certain letters for others. Sherlock Holmes used a similar cipher to decode the "dancing man" letters and solve the case. The code below comes with Al Bhed predefined, but any other cipher works. Just define your own string of unique characters. 

Here is how to convert English to Al Bhed:

English: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Al Bhed: YPLTAVKREZGMSHUBXNCDIJFQOW

For example, "You are cute" in English is rendered as "Oui yna lida" in Al Bhed:

You--> Oui  (* Y --> O , * O --> U , * U --> I)
 
are --> yna  (* A --> Y, * R --> N, * E --> A)

cute --> lida  (*C --> L , * O --> U, *T --> D, * E --> A)

Usage:
Change channel 7576 for your preferred channel. Paste this script on a prim you own, give copies of the prim to all friends you want to chat al bhed with (translations are only viewed by prim owners)

To say "You are cute" and get al bhed:
/7576 &You are cute
(prim says "Oui yna lida" on normal chat. You and all other script owners using the same channel will see a second message with the translation "You are cute")

To talk directly in al bhed:
/7576 @Oui yna lida
(prim will repeat "Oui yna lida" in normal chat and translate it to "You are cute" to all script  owners on the same channel). This allows people talking al bhed on different channels to understand each other. Just repeat the message to translate to your own channel, with an @ before it, prim will give you a private translation.

Any message not starting with the Al Bhed tag "@" or the "normal" tag "&" will be ignored. This is good in case someone else or some other script is using the same channel you are. The tags can be replaced by your own tags (Apipe, Epipe)

This script works to translate any language to al bhed (or other cipher). Can work with kanji too, just change the "english" string to kanji and the "al bed" string to the equivalent kanji.

It actually is a very flexible,  lightning fast cipher encoder / decoder. Hope you enjoy it!

Download this script - Please use this link to get this script. If you see all the code on one long line, please use Wordpad or another editor, such as LSLEdit.exe. The .LSL file you will download is an ordinary text file.

1 integer AChan=7576;
2 vector red = <1,0,0>;
3 vector green = <0,1,0>;
4 string Apipe = "@";
5 string Epipe = "&";
6 string english = " abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
7 string albhed = " ypltavkrezgmshubxncdijfqowYPLTAVKREZGMSHUBXNCDIJFQOW";
8 // to use any other cypher besides al bhed, just replace the string "al bhed" value with unique charaters
9
10 default
11 {
13 {
14 llListen(AChan, "","", "" );
15 llSetText(".",green,1.0);
16 llSetText("speak on channel "+ (string) AChan +" prefaced with "+ Epipe +" to get al bhed, \n you can say albhed text on channel "+ (string) AChan +" but prefaced with "+ Apipe +" to get it translated back to normal",green,1.0);
17 }
18
19 listen( integer channel, string name, key id, string message )
20 {
21
22 integer c = llStringLength(message);
23 string newmessage = "" ;
24 string lcode="";
25 string lcodet="";
26 integer j= 0;
27 integer k= 0;
28 integer i = 1;
29 j=llSubStringIndex(message,Apipe);
30 string message1="";
31 k=llSubStringIndex(message,Epipe);
32 if (j>=0)
33 {
34 for (; i < c; ++i)
35 {
36 lcode = llGetSubString(message,i,i);
37 integer fstop = llSubStringIndex(albhed,lcode);
38 if (fstop > 0)
39 lcodet = llGetSubString(english,fstop,fstop);
40 else
41 lcodet = lcode;
42
43 newmessage += lcodet;
44 }
45 message1 = llGetSubString(message,1,c-1);
46 llOwnerSay("("+name+" says secretly in al bhed) "+newmessage);
47 llSay(0,"("+name+" says in al bhed) "+message1);
48
49 } else {
50 if (k>=0)
51 {
52 for (; i < c; ++i)
53 {
54 lcode = llGetSubString(message,i,i);
55 integer fstop = llSubStringIndex(english,lcode);
56 if (fstop > 0)
57 lcodet = llGetSubString(albhed,fstop,fstop);
58 else
59 lcodet = lcode;
60
61 newmessage += lcodet;
62 }
63 message1 = llGetSubString(message,1,c-1);
64 llOwnerSay("("+name+" says secretly in al bhed) "+message1);
65 llSay(0,"("+name+" says in al bhed) "+newmessage);
66
67 } else {
68 llSay(0,"message --"+message+"-- by "+name+" on chanel "+(string) AChan+" ignored");
69 }
70 }
71 }
72 }