BuildSlurl (NewAge)

From Second Life Wiki
Revision as of 16:39, 2 September 2010 by Fred Gandt (talk | contribs) (Added delete template. I feel mean but the content isn't what I would call helpful but the page name (with the "ll" prefix) seems to suggest one will find a Linden Library function.)
Jump to navigation Jump to search
Deletion Requested
The deletion of this article was requested for the following reason:

The name of this page is misleading and the content is (for want of kinder words) not terribly helpful. The content could be simply edited to provide a better example/function but would remain confusingly/inappropriately named. Surely it is best that ONLY genuine Linden Library functions have pages titled in such a way (with the "ll" prefix).

If there is a need to discuss the deletion of this article, please add your comment(s) here.


llSLURL

A way of creating SLURL's by using a pre-made function;

llSLURL(string region_name, vector pos);

Pre-made Function

<lsl> string llSLURL(string region_name, vector pos) {

   string slurl = "secondlife://";
   list parse = llParseString2List(region_name, [" "], []);
   if(llGetListLength(parse) != 0)
   {
       integer i = 0;
       integer all = llGetListLength(parse)-1;
       do
       {
           if(llStringLength(llList2String(parse, i)) > 0)
           {
               slurl += llList2String(parse, i);
               if((i != all)||(i < all))
               {
                   slurl += "%20";
               }
           }
       }while(i++<all);
   }
   else
   {
       slurl += region_name;
   }
   parse = llParseString2List((string)pos, ["<", ",", ">"], []);
   slurl+="/"+(string)((integer)llList2String(parse, 0))+"/"+(string)((integer)llList2String(parse, 1))+"/"+(string)((integer)llList2String(parse, 2));
   return slurl;

} </lsl>


Example Script

<lsl> string llSLURL(string region, vector pos) {

   string slurl = "secondlife://";
   list parse = llParseString2List(region, [" "], []);
   if(llGetListLength(parse) != 0)
   {
       integer i = 0;
       integer all = llGetListLength(parse)-1;
       do
       {
           if(llStringLength(llList2String(parse, i)) > 0)
           {
               slurl += llList2String(parse, i);
               if((i != all)||(i < all))
               {
                   slurl += "%20";
               }
           }
       }while(i++<all);
   }
   else
   {
       slurl += region_name;
   }
   parse = llParseString2List((string)pos, ["<", ",", ">"], []);
   slurl+="/"+(string)((integer)llList2String(parse, 0))+"/"+(string)((integer)llList2String(parse, 1))+"/"+(string)((integer)llList2String(parse, 2));
   return slurl;

}

default {

   touch_start(integer x)
   {
       llWhisper(0, llSLURL(llGetRegionName(), llGetPos()));
       //Returns slurl like this;
       //       secondlife://Phoenix%20Rising/214/160/24
   }

} </lsl>