BuildSlurl (NewAge)

From Second Life Wiki
Revision as of 23:53, 3 September 2010 by Zai Lynch (talk | contribs) (code cleanup)
Jump to navigation Jump to search

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

BuildSlurl(string region_name, vector pos);

Pre-made Function

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

   return "secondlife://" + llEscapeURL(region_name) 
           + "/"+ (string)((integer)pos.x) 
           + "/"+ (string)((integer)pos.y) 
           + "/"+ (string)(llCeil(pos.z));

}</lsl>


Example Script

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

   return "secondlife://" + llEscapeURL(region_name) 
           + "/"+ (string)((integer)pos.x) 
           + "/"+ (string)((integer)pos.y) 
           + "/"+ (string)(llCeil(pos.z));

}

default {

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

} </lsl>