Difference between revisions of "LlLoadURL"

From Second Life Wiki
Jump to: navigation, search
m (changed order of flags (func= THEN sort=) to attempt proper placement in function category)
m (<lsl> tag to <source>)
 
(23 intermediate revisions by 9 users not shown)
Line 1: Line 1:
 
{{LSL_Function
 
{{LSL_Function
|func_id=297|func_sleep=10.0|func_energy=10.0
+
|inject-2={{LSL_Function/avatar|avatar|sim=*}}{{LSL Function/limits}}{{LSL_Function/chat||message|dialog=dialog box}}
 +
|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_id
+
|p1_type=key|p1_name=avatar
 
|p2_type=string|p2_name=message
 
|p2_type=string|p2_name=message
 
|p3_type=string|p3_name=url
 
|p3_type=string|p3_name=url
|func_footnote=The '''url''' is truncated to 255 characters and '''message''' is truncated to 254 characters. Introduced in version 1.6, this function was disabled for group deeded items. As of version ~1.9, the function was enabled for group deeded items. In the server upgrade released on 2007-03-14, it appears that the function is again disabled for group deeded items (please change it back!).
+
|func_footnote=The {{LSLP|url}} is truncated to 255 characters and {{LSLP|message}} is truncated to 254 characters.<br/>The protocol for the {{LSLP|url}} must be specified, currently only "https://" and "http://" are supported.<br/>The URL should be {{RFC|1738}} compliant with proper escapes.
|func_desc=Shows dialog to avatar '''avatar_id''' offering to load web page at '''url''' with '''message'''.<br/>If user clicks yes, launches the page in their web browser, starting the browser if required.
+
|func_desc=Shows dialog to {{LSLP|avatar}} offering to load web page at {{LSLP|url}} with {{LSLP|message}}.<br/>If user clicks yes, launches the page in their web browser, starting the browser if required.
 
|return_text
 
|return_text
 
|spec
 
|spec
|caveats
+
|caveats=*This function should not be called from group deeded objects{{Footnote|This was not always the case, see [[#History|History]] for details}}, it will silently fail.
 +
*This function silently fails for an avatar that has muted itself.{{Footnote|This can be extremely bewildering to debug because there's no easy way for a user to self-mute. Apparently it "just happens."}}
 
|constants
 
|constants
 
|examples=
 
|examples=
<div style="margin:0.4em 0em 0.5em 0em;border:1px solid #AAAAAA;line-height:1.1em;font-family: Courier New, Courier, mono;padding-top: 0.5em;padding: 0.5em 0em 0.5em 0.5em;">
+
<source lang="lsl2">
<div style="color: #FF7700;">// Display URL Dialog</div>
+
default
  <div style="color: #A00000;">default</div>
+
{
  <div>{</div>
+
    touch_start(integer num_detected)
  <div>{{Tab}}<span style="color: #A00000">touch_start</span>(<span style="color: #007700;">integer</span> num_detected)</div>
+
    {
  <div>{{Tab}}{</div>
+
        key     id              = llDetectedKey(0);
  <div>{{Tab|2}}<span style="color: #007700;">key</span> gAvatarKey = <span style="color: #A00000;">[[llDetectedKey]](0)</span>;</div>
+
        integer avatarInSameSim = (llGetAgentSize(id) != ZERO_VECTOR);// TRUE or FALSE
  <div>{{Tab|2}}<span style="color: #A00000">llLoadURL</span>(gAvatarKey, <span style="color: #007700">"View the offical Second Life website."</span>, <span style="color: #007700">"<nowiki>http://www.secondlife.com"</nowiki></span>);</div>
+
 
  <div>{{Tab}}}</div>
+
        if (avatarInSameSim)
  <div>}</div>
+
        {
</div>
+
            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!");
 +
        }
 +
    }
 +
}
 +
</source>
 
|helpers
 
|helpers
 
|also_functions
 
|also_functions
 
|also_events
 
|also_events
 
|also_articles
 
|also_articles
|also_tests
+
|also_tests=
 +
{{LSL DefineRow|[[llLoadURL Test]]|}}
 
|notes
 
|notes
|permission
+
|history=
|negative_index
+
*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.
 
|cat1=Dialog
 
|cat1=Dialog
 
|cat2
 
|cat2

Latest revision as of 12:18, 22 January 2015

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);
        integer avatarInSameSim = (llGetAgentSize(id) != ZERO_VECTOR);// TRUE or FALSE
 
        if (avatarInSameSim)
        {
            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!");
        }
    }
}

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