Difference between revisions of "User:Ugleh Ulrik"
Ugleh Ulrik (talk | contribs) |
Ugleh Ulrik (talk | contribs) |
||
Line 94: | Line 94: | ||
DialogPlus [[DialogPlus ]] | DialogPlus [[DialogPlus ]] | ||
== Encryption / Decryption == | |||
<lsl> | |||
string enc(string source){ | |||
string new; | |||
list s1 = ["!", " ","#","$","%","&","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","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","[","]","^","_","`","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 s2 = ["y","n","C","?","q","Z","d","`","B","u","t","<",";","a","+","J","[","m","7","M","v","I","g","}","i","]","K","L","k","H","W","@","P","Y","4","{","V","Q","x","(","O","X","0","=","T","c","9","[","z","N","r","|","^","!","h","F","3",".","8","/","5","6",">","1","A","~","D","U","p","o","_","$","&","l","*","R","w","S","-","f","G","2","E","e","b","#",":",")","s","%","j"," "]; | |||
integer s; | |||
integer l = llStringLength(source); | |||
do | |||
new+= llList2String(s2,llListFindList(s1, [llGetSubString(source,s,s)])); | |||
while(l>++s); | |||
return new; | |||
} | |||
string dec(string source){ | |||
string new; | |||
list s2 = ["!", " ","#","$","%","&","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","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","[","]","^","_","`","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 s1 = ["y","n","C","?","q","Z","d","`","B","u","t","<",";","a","+","J","[","m","7","M","v","I","g","}","i","]","K","L","k","H","W","@","P","Y","4","{","V","Q","x","(","O","X","0","=","T","c","9","[","z","N","r","|","^","!","h","F","3",".","8","/","5","6",">","1","A","~","D","U","p","o","_","$","&","l","*","R","w","S","-","f","G","2","E","e","b","#",":",")","s","%","j"," "]; | |||
integer s; | |||
integer l = llStringLength(source); | |||
do | |||
new+= llList2String(s2,llListFindList(s1, [llGetSubString(source,s,s)])); | |||
while(l>++s); | |||
return new; | |||
} | |||
default | |||
{ | |||
touch_start(integer total_number) | |||
{ | |||
string encoded = enc("Hello There");//encoding the string "Hello There" | |||
llSay(0, encoded);//Outputting it | |||
string decoded = dec(encoded);//Decoding the encoded text, returning back "Hello There" | |||
llSay(0, decoded);//Outputting it | |||
} | |||
} | |||
</lsl> |
Revision as of 01:24, 24 May 2010
About
Im just your average Ugleh. I hang out in SL, helping the scripting groups with my knowledge. I create weapons, utilities, games, and pretty much anything. I work for Learn Avatar as a teacher, in return i get a small piece of land to keep my projects including my inworld servers. I can script projects for free if simple, if not id ask for some lindens, but i never name prices, you name your own price and ill accept what you give me.
XStreetSL
Vector2List
<lsl> list Vector2List(vector v){
list alist = llParseString2List((string)v,[",", ">", "<"],[]);
return alist; } </lsl> or <lsl> list Vector2List(vector v){
return [v.x, v.y, v.z]; // *Tips a wink to Strife*
} </lsl>
More at User:Ugleh_Ulrik/Vector2List
FirstName
<lsl> string FirstName(key k){ list fn = llParseString2List(llKey2Name(k),[" "],[]); string firstn = llList2String(fn,0); return firstn; } </lsl> More at User:Ugleh_Ulrik/FirstName
LastName
<lsl> string LastName (key k){ list ln = llParseString2List(llKey2Name(k),[" "],[]); string lastn = llList2String(ln,1); return lastn; } </lsl> More at User:Ugleh_Ulrik/LastName
trimstring
<lsl> string trimstring(string text, integer length) {
if (length < llStringLength(text)){ length = length-1; string newstring = llGetSubString(text,0, length) + "..."; return newstring;
}else{
return text;
} } </lsl> More at User:Ugleh_Ulrik/trimstring
GiveBulkMoney
<lsl> GiveBulkMoney(list u, integer amount){ integer a = 0; while(a < llGetListLength(u)) {
llGiveMoney(llList2Key(u,a), amount); ++a;
} } </lsl> More at User:Ugleh_Ulrik/GiveBulkMoney
Other Scripts
PHP Name2Key User:Ugleh_Ulrik/Name2Key
Random String RandomString
Time Ago TimeAgo
DialogPlus DialogPlus
Encryption / Decryption
<lsl> string enc(string source){
string new;
list s1 = ["!", " ","#","$","%","&","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","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","[","]","^","_","`","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 s2 = ["y","n","C","?","q","Z","d","`","B","u","t","<",";","a","+","J","[","m","7","M","v","I","g","}","i","]","K","L","k","H","W","@","P","Y","4","{","V","Q","x","(","O","X","0","=","T","c","9","[","z","N","r","|","^","!","h","F","3",".","8","/","5","6",">","1","A","~","D","U","p","o","_","$","&","l","*","R","w","S","-","f","G","2","E","e","b","#",":",")","s","%","j"," "]; integer s; integer l = llStringLength(source); do new+= llList2String(s2,llListFindList(s1, [llGetSubString(source,s,s)])); while(l>++s); return new; }
string dec(string source){
string new;
list s2 = ["!", " ","#","$","%","&","(",")","*","+",",","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","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","[","]","^","_","`","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 s1 = ["y","n","C","?","q","Z","d","`","B","u","t","<",";","a","+","J","[","m","7","M","v","I","g","}","i","]","K","L","k","H","W","@","P","Y","4","{","V","Q","x","(","O","X","0","=","T","c","9","[","z","N","r","|","^","!","h","F","3",".","8","/","5","6",">","1","A","~","D","U","p","o","_","$","&","l","*","R","w","S","-","f","G","2","E","e","b","#",":",")","s","%","j"," "]; integer s; integer l = llStringLength(source); do new+= llList2String(s2,llListFindList(s1, [llGetSubString(source,s,s)])); while(l>++s); return new; }
default {
touch_start(integer total_number) { string encoded = enc("Hello There");//encoding the string "Hello There" llSay(0, encoded);//Outputting it string decoded = dec(encoded);//Decoding the encoded text, returning back "Hello There" llSay(0, decoded);//Outputting it }
}
</lsl>