Difference between revisions of "LlLoadURL"

From Second Life Wiki
Jump to navigation Jump to search
m
(rewrote the example to be more useful, and to reflect proper terminology)
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{LSL_Function/avatar|avatar|sim=*}}{{LSL Function/limits}}{{LSL_Function/chat||message|dialog=dialog box}}
|inject-2={{LSL_Function/avatar|avatar|sim=*}}{{LSL Function/limits}}{{LSL_Function/chat||message|dialog=dialog box}}
|func_id=297|func_sleep=10.0|func_energy=10.0
|func_id=297|func_sleep=0.1|func_energy=10.0
|func=llLoadURL|sort=LoadURL
|func=llLoadURL|sort=LoadURL
|p1_type=key|p1_name=avatar
|p1_type=key|p1_name=avatar
Line 14: Line 14:
|constants
|constants
|examples=
|examples=
<lsl>// Display URL Dialog
<syntaxhighlight lang="lsl2">
default
default
{
{
     touch_start(integer num_detected)
     touch_start(integer num_detected)
     {
     {
         key gAvatarKey = llDetectedKey(0);
         key id = llDetectedKey(0);
         llLoadURL(gAvatarKey, "View the offical Second Life website.", "http://www.secondlife.com");
         string info = "Visit the Second Life website!";
    }
       
}</lsl>
        // must start with either "http://..." or "https://..."
<lsl>
        string url = "http://www.secondlife.com/";
//Compact Script by Alessandro Spires to SecondBits and Second Life
       
default
        integer avatarInSameRegion = (llGetAgentSize(id) != ZERO_VECTOR); // TRUE or FALSE
{
  touch_start(integer num_detected)
  {
      llLoadURL(llDetectedKey(0), "Visit the Second Life", "http://www.secondlife.com"); 
  }
}</lsl>
<lsl>//Emmas Seetan
//21 September 17:06
 
string text = "Visit the Second Life Wiki!"; //Floating text
string url = "https://wiki.secondlife.com/"; //must include 'http://'


default
        if (avatarInSameRegion)
{
        {
    touch_start(integer num_detected)
            llLoadURL(id, info, url);
    {
        }
        llLoadURL(llDetectedKey(0), text, url); //Loads the URL
        else
        {
            // if the agent is not in the same region, send a message instead
            // the viewer will turn the URL clickable
            llInstantMessage(id, info + " " + url);
        }
     }
     }
}</lsl>
}
</syntaxhighlight>
|helpers
|helpers
|also_functions
|also_functions

Latest revision as of 01:42, 28 January 2024

Summary

Function: llLoadURL( key avatar, string message, string url );

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 0.1 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]
All Issues ~ Search JIRA for related Bugs

Examples

default
{
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
        string info = "Visit the Second Life website!";
        
        // must start with either "http://..." or "https://..."
        string url = "http://www.secondlife.com/";
        
        integer avatarInSameRegion = (llGetAgentSize(id) != ZERO_VECTOR); // TRUE or FALSE

        if (avatarInSameRegion)
        {
            llLoadURL(id, info, url);
        }
        else
        {
            // if the agent is not in the same region, send a message instead
            // the viewer will turn the URL clickable
            llInstantMessage(id, info + " " + url);
        }
    }
}

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.
Search JIRA for related Issues

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 );