Tuesday, January 6, 2009

SLURL Print Function

Script function library. Released to Public Domain. Will apply indents once I figure out how to in Blogger.

string SLURL;

string SLURLFetch(string region, vector pos)
{
//Author of this function: Kamilah Hauptmann, Jan 4, 2009.
list Parse = llParseString2List(region, [], [" "]);
if(llList2String(Parse, 1) == " ")//in case of a two word sim name
{
Parse = llListReplaceList(Parse, ["%20"], 1, 1);
}
if(llList2String(Parse, 3) == " ")//In case of a three word sim name
{
Parse = llListReplaceList(Parse, ["%20"], 3, 3);
}
if(llList2String(Parse, 5) == " ")//In case of a four word sim name O.o
{
Parse = llListReplaceList(Parse, ["%20"], 5, 5);
}
string SimName = llDumpList2String(Parse, "");
integer X = (integer)pos.x;
integer Y = (integer)pos.y;
integer Z = (integer)pos.z;
return "http://slurl.com/secondlife/" + SimName + "/" + (string)X + "/" + (string)Y + "/" + (string)Z + "/";//Woot! A usable SLURL!
}

No comments: