Reply
Posts: 930
Registered: ‎10-05-2009
0 Kudos

Basic Role Play translator

Below is code for a basic translator, you chat in channel 88 or any you choose, the sting is jumbled up to look like a foreign language and printed out in chat, anyone with the same icon will be able to translate it back, it will be said in owner say when translated so no one else can see it.

The icon must be a char that is not likely to be typed by anyone else, it is don't as list's instead of strings so that you can replace single letters with more than one, or symbols, it is fun to play with. In a role play situation each group would speak their own race language so other races did not understand what you were saying

example type

/88hello

♦jbuuw 

will be printed out in chat.

anyone in chat range with "♦" as there icon will pick it up and it will be translated and printed back in owner chat.

 

list charsin = ["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"];
list charsout = ["e","k","i","p","b","r","v","j","d","q","o","u","g","t","w","a","s","h","f","n","c","x","m","z","l","y"];
integer channel = 88;
string icon = "♦";
default
{
    on_rez(integer p){llResetScript();}
    state_entry()
    {
     llSetMemoryLimit(0x6000);
     llListen(channel,"",llGetOwner(),"");
     llListen(0,"","","");
    }
   
   listen(integer chan, string name, key id, string option)
    {
     integer x;
     integer y = llStringLength(option);
     string result;   
     string a;
     integer ix;
     if(chan==channel)
      {
       for(x=0;x<y;x++)
        {
         a = llGetSubString(option,x,x);
         ix = llListFindList(charsin,[a]);   
         if(ix!=-1)result+=llList2String(charsout,ix);
         else result += a;  
        }
       llSay(0,icon+result);      
      }
     else if((!chan)&&(llGetSubString(option,0,0)==icon))
      {
       for(x=0;x<y;x++)
        {
         a = llGetSubString(option,x,x);
         ix = llListFindList(charsout,[a]);   
         if(ix!=-1)result+=llList2String(charsin,ix);
         else result += a;  
        }
       llOwnerSay(result);  
      } 
    }
}

 

http://www.msdcs.co.uk/v2combat_meters/

http://marketplace.secondlife.com/stores/18253
Recognized Resident
ZachSmith
Posts: 3
0 Kudos

Re: Basic Role Play translator

Reply to Lucinda Bulloch - view message

I like the twist you put on this. I actually made something of same concept I just did not go to quite the lengths. I merely used the channels to an advantage and had the other person listen to the message they typed on channel 88 and said in OwnerSay. I like that there was much more thought added to this and I think it is great work.

Honored Resident
DarkAngler
Posts: 16
0 Kudos

Re: Basic Role Play translator

Reply to Lucinda Bulloch - view message

I was excited to see this - now, at long last, there can be a translator for my race! Thank you

This signature is only a figment of your imagination.