Difference between revisions of "LlLoadURL"

From Second Life Wiki
Jump to navigation Jump to search
m
m (changed example script to make caveats more clear)
Line 19: Line 19:
     touch_start(integer num_detected)
     touch_start(integer num_detected)
     {
     {
         key id = llDetectedKey(0);// the touching avatar's key, must be in same region
         key id = llDetectedKey(0);
        string info = "Visit the Second Life website!";// some info text for the dialog menu
        string url = "http://www.secondlife.com";// must start with either "http://..." or "https://..."


         llLoadURL(id, info, url);
         // if the touching avatar is in the same sim
        if ( llGetAgentSize(id) )
        {
            string info = "Visit the Second Life website!";
 
            // must start with either "http://..." or "https://..."
            string url = "http://www.secondlife.com";
 
            llLoadURL(id, info, url);
        }
        else
            llInstantMessage(id, "I can only open a URL dialog on your screen if you're in my sim!");
     }
     }
}
}

Revision as of 06:09, 6 October 2012

Summary

Function: llLoadURL( key avatar, string message, string url );
10.0 Forced Delay
10.0 Energy

Shows dialog to avatar offering to load web page at url with message.
If user clicks yes, launches the page in their web browser, starting the browser if required.

• key avatar avatar UUID that is in the same region
• string message message to be displayed in the dialog box
• string url

The url is truncated to 255 characters and message is truncated to 254 characters.
The protocol for the url must be specified, currently only "https://" and "http://" are supported.
The URL should be RFC-1738 compliant with proper escapes.

Caveats

  • This function causes the script to sleep for 10.0 seconds.
  • This function should not be called from group deeded objects[1], it will silently fail.
  • This function silently fails for an avatar that has muted itself.[2]

Examples

<lsl> default {

   touch_start(integer num_detected)
   {
       key id = llDetectedKey(0);
       // if the touching avatar is in the same sim
       if ( llGetAgentSize(id) )
       {
           string info = "Visit the Second Life website!";
           // must start with either "http://..." or "https://..."
           string url = "http://www.secondlife.com";
           llLoadURL(id, info, url);
       }
       else
           llInstantMessage(id, "I can only open a URL dialog on your screen if you're in my sim!");
   }

}

</lsl>

See Also

Articles

•  Limits SL limits and constrictions

Deep Notes

History

  • Introduced in version 1.6, no support for group deeded objects.
  • As of version ~1.9, support for group deeded objects was added (possibly by accident).
  • In the server upgrade released on 2007-03-14, support for group deeded objects was removed.

Tests

• llLoadURL Test

Footnotes

  1. ^ This was not always the case, see History for details
  2. ^ This can be extremely bewildering to debug because there's no easy way for a user to self-mute. Apparently it "just happens."

Signature

function void llLoadURL( key avatar, string message, string url );