Difference between revisions of "User:Bobbyb30 Zohari/snippets"

From Second Life Wiki
Jump to navigation Jump to search
m (Bobbyb's snippets moved to User:Bobbyb30 Zohari/snippets: user pages in user spaces)
 
(7 intermediate revisions by one other user not shown)
Line 17: Line 17:
}
}
</lsl>
</lsl>
<lsl>
//Written by Strife Onizuka
//Output hex as a string
///
//Optimized by Bobbyb30 Zohari
string hex2string(integer bits)
{
string hexc = "0123456789ABCDEF";
integer chr = (bits & 0xF);
string result = llGetSubString(hexc, chr, chr);
if((bits = (0xfffFFFF & (bits >> 4))))
do
result = llGetSubString(hexc, chr = (bits & 0xF), chr) + result);
while (bits = (bits >> 4));
return result;
}
</lsl>
<lsl>
//Faster Version
//Bobbyb30 Zohari (C) 2008
//June 29,2008
//Date to proper vector (month day year v. year day month)-american standard
vector date()
{
string datexx = llGetDate();
return <(integer)llGetSubString(datexx,8,9),(integer)llGetSubString(datexx,5,6),(integer)llGetSubString(datexx,0,3)>
}
//Bobbyb30 Zohari (C) 2008
//April 1, 2008
//Date to proper vector (month day year v. year day month)
vector date()
{
list listdate = llParseString2List(llGetDate(),["-"],[]);//ymd
return < llList2Integer(listdate,1),llList2Integer(listdate,2),llList2Integer(listdate,0)>;//mdy
}
</lsl>
<lsl>
//Bobbyb30 Zohari (C) 2008
//April 3, 2008
//Random Key Generator
string letter = "0123456789abcdef";
string l()//random letter
{
integer random = (integer)llFrand(16);
return llGetSubString(letter,random,random);
}
string randomkyey()//random key
{
//
return
l() + l() + l() + l() + l() + l() + l() + l() + "-"//8
+ l() + l() + l() + l()+ "-"//4
+ l() + l() + l() + l()+ "-"//4
+ l() + l() + l() + l()+ "-"//4
+ l() + l() + l() + l() + l() + l() + l() + l() + l() + l() + l() + l();//11
}
</lsl>
<lsl>
//Bobbyb30 Zohari (C) 2008
//June 29, 2008
//Year Finder...good for ensuring your (C) never expires=D
string year()
{
return llGetSubString(llGetDate(),0,3);//returns the year
}
https://wiki.secondlife.com/wiki/User:Bobbyb30_Zohari

Latest revision as of 22:10, 11 April 2009

These are some of the scripts(and snippets of code) that Bobbyb30 has either written, optimized, or utilized. If you use these snippets or scripts, please give credit where it is deserved.

<lsl> //Bobbyb30 Zohari (C) 2008 //March 25, 2008 //RGB Hex Converter //---- //Convert Hex to RGB format //Can also be used for decompression of vectors in Hex format

vector hex2rgb(integer hex) { float x = (rgba >> 16) & 0xFF; float y = (rgba >> 8) & 0xFF; float z = rgba & 0xFF; return <x,y,z>; } </lsl>

<lsl> //Written by Strife Onizuka //Output hex as a string /// //Optimized by Bobbyb30 Zohari string hex2string(integer bits) { string hexc = "0123456789ABCDEF"; integer chr = (bits & 0xF); string result = llGetSubString(hexc, chr, chr); if((bits = (0xfffFFFF & (bits >> 4)))) do result = llGetSubString(hexc, chr = (bits & 0xF), chr) + result); while (bits = (bits >> 4)); return result; } </lsl>

<lsl> //Faster Version //Bobbyb30 Zohari (C) 2008 //June 29,2008 //Date to proper vector (month day year v. year day month)-american standard vector date() { string datexx = llGetDate(); return <(integer)llGetSubString(datexx,8,9),(integer)llGetSubString(datexx,5,6),(integer)llGetSubString(datexx,0,3)> }

//Bobbyb30 Zohari (C) 2008 //April 1, 2008 //Date to proper vector (month day year v. year day month) vector date() { list listdate = llParseString2List(llGetDate(),["-"],[]);//ymd return < llList2Integer(listdate,1),llList2Integer(listdate,2),llList2Integer(listdate,0)>;//mdy } </lsl>

<lsl> //Bobbyb30 Zohari (C) 2008 //April 3, 2008 //Random Key Generator string letter = "0123456789abcdef";

string l()//random letter { integer random = (integer)llFrand(16); return llGetSubString(letter,random,random); } string randomkyey()//random key { // return l() + l() + l() + l() + l() + l() + l() + l() + "-"//8 + l() + l() + l() + l()+ "-"//4 + l() + l() + l() + l()+ "-"//4 + l() + l() + l() + l()+ "-"//4 + l() + l() + l() + l() + l() + l() + l() + l() + l() + l() + l() + l();//11 } </lsl>

<lsl> //Bobbyb30 Zohari (C) 2008 //June 29, 2008 //Year Finder...good for ensuring your (C) never expires=D

string year() { return llGetSubString(llGetDate(),0,3);//returns the year }

https://wiki.secondlife.com/wiki/User:Bobbyb30_Zohari