Difference between revisions of "BuildSlurl (NewAge)"

From Second Life Wiki
Jump to navigation Jump to search
(Created page with '====llSLURL==== Easiest way of creating SLURL's by using a pre-made function; llSLURL(string region_name, vector pos); ''Pre-made Function'' <lsl> string llSLURL(string regi...')
 
Line 29: Line 29:
     else
     else
     {
     {
         slurl += llGetRegionName();
         slurl += region_name;
     }
     }
     parse = llParseString2List((string)pos, ["<", ",", ">"], []);
     parse = llParseString2List((string)pos, ["<", ",", ">"], []);
Line 64: Line 64:
     else
     else
     {
     {
         slurl += llGetRegionName();
         slurl += region_name;
     }
     }
     parse = llParseString2List((string)pos, ["<", ",", ">"], []);
     parse = llParseString2List((string)pos, ["<", ",", ">"], []);

Revision as of 01:59, 28 August 2010

llSLURL

Easiest 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>