Difference between revisions of "LlMapDestination"

From Second Life Wiki
Jump to navigation Jump to search
m (LSL llMapDestination moved to LlMapDestination: removing prefix)
m
(30 intermediate revisions by 13 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|inject-2={{Issues/SVC-3455}}{{Issues/SVC-1038}}{{Issues/SVC-1795}}{{Issues/VWR-2060}}{{Issues/VWR-7331}}
{{LSL Function/position|pos|region=*}}
{{LSL Function/position|look_at|local=*}}
|func_id=309|func_sleep=1.0|func_energy=10.0
|func_id=309|func_sleep=1.0|func_energy=10.0
|func=llMapDestination|sort=MapDestination
|func=llMapDestination|sort=MapDestination
|p1_type=string|p1_name=simname
|p1_type=string|p1_name=simname|p1_desc=Region name
|p2_type=vector|p2_name=pos
|p2_type=vector|p2_name=pos
|p3_type=vector|p3_name=look_at|p3_desc=not used
|p3_type=vector|p3_name=look_at|p3_desc= (not used)
|func_footnote=(NOTE: '''look_at''' currently does nothing)
|func_footnote=(NOTE: {{LSLP|look_at}} currently does nothing)
|func_desc=Opens world map centered on region with '''pos''' highlighted.<br />Only works for scripts {{LSLG|attach}}ed to avatar, or during {{LSLG|touch}} events.
|func_desc=Opens world map centered on {{LSLP|simname}} with {{LSLP|pos}} highlighted.<br />Only works for scripts [[attach]]ed to avatar, or during {{LSLGC|Touch|touch}} events.
|return_text
|return_text
|spec
|spec
|caveats
|caveats=
* if {{LSLP|simname}} is {{HoverText|omitted|an empty string: {{String}}}} or invalid, the map will open centered on object, but {{LSLP|pos}} will not be highlighted. Since this function requests the client to perform a task, there is no way for script to know if it has failed.
|constants
|constants
|examples
|examples=
<source lang="lsl2">
string simName = "Help Island Public";
vector tpDest = <128.0, 128.0, 24.0>;
vector lookAt = ZERO_VECTOR;
 
default
{
    state_entry()
    {
        // set white, opaque floattext with teleport destination
        llSetText("click to teleport\nto '" + simName + "'", <1.0, 1.0, 1.0>, (float)TRUE);
    }
 
    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);
 
        string oldSlurlPrefix = "http://slurl.com/secondlife/";
        string newSlurlPrefix = "http://maps.secondlife.com/secondlife/";
        string slurlSuffix = llEscapeURL(simName)
            + "/" + (string)llRound(tpDest.x)
            + "/" + (string)llRound(tpDest.y)
            + "/" + (string)llRound(tpDest.z);
 
        llInstantMessage(id, oldSlurlPrefix + slurlSuffix);
        llInstantMessage(id, newSlurlPrefix + slurlSuffix);
 
        llMapDestination(simName, tpDest, lookAt);
    }
}
</source>
|helpers
|helpers
|also_functions
|also_functions=
{{LSL DefineRow||[[llRequestInventoryData]]|}}
|also_tests
|also_tests
|also_events
|also_events
|also_articles
|also_articles
|notes
|notes=
* {{LSLP|pos}} will work with [[Viewer_coordinate_frames#Region|Region]] coordinates not inside {{LSLP|simname}}. (like those returned by [[llRequestInventoryData]])
* if called from non {{LSLGC|Touch|touch}} events, it only works for the {{LSLGC|Owner|owner}}.
* if called from touch, it may only work for the first or last touch in the event queue (example: num_touched > 1)
* if called inside an [[attachment]], it only works for the owner.
|permission
|permission
|inventory
|inventory
Line 23: Line 63:
|cat1=Dialog
|cat1=Dialog
|cat2=Attachment
|cat2=Attachment
|cat3
|cat3=Avatar
|cat4
|cat4=Touch
|issues
}}
}}

Revision as of 18:53, 12 March 2016

Summary

Function: llMapDestination( string simname, vector pos, vector look_at );

Opens world map centered on simname with pos highlighted.
Only works for scripts attached to avatar, or during touch events.

• string simname Region name
• vector pos position in region coordinates
• vector look_at position in local coordinates (not used)

(NOTE: look_at currently does nothing)

Caveats

  • This function causes the script to sleep for 1.0 seconds.
  • if simname is omitted or invalid, the map will open centered on object, but pos will not be highlighted. Since this function requests the client to perform a task, there is no way for script to know if it has failed.

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   llMapDestination ignores look_at parameter
   llMapDestination in attachments opens a map on owner's screen even when touched by someone else
   llMapDestination pos parameter is sometimes replaced with incorrect data (workaround included)
   height in pos is capped to 1000m (code patch included)

Examples

string simName = "Help Island Public";
vector tpDest = <128.0, 128.0, 24.0>;
vector lookAt = ZERO_VECTOR;

default
{
    state_entry()
    {
        // set white, opaque floattext with teleport destination
        llSetText("click to teleport\nto '" + simName + "'", <1.0, 1.0, 1.0>, (float)TRUE);
    }

    touch_start(integer num_detected)
    {
        key id = llDetectedKey(0);

        string oldSlurlPrefix = "http://slurl.com/secondlife/";
        string newSlurlPrefix = "http://maps.secondlife.com/secondlife/";
        string slurlSuffix = llEscapeURL(simName)
            + "/" + (string)llRound(tpDest.x)
            + "/" + (string)llRound(tpDest.y)
            + "/" + (string)llRound(tpDest.z);

        llInstantMessage(id, oldSlurlPrefix + slurlSuffix);
        llInstantMessage(id, newSlurlPrefix + slurlSuffix);

        llMapDestination(simName, tpDest, lookAt);
    }
}

Notes

  • pos will work with Region coordinates not inside simname. (like those returned by llRequestInventoryData)
  • if called from non touch events, it only works for the owner.
  • if called from touch, it may only work for the first or last touch in the event queue (example: num_touched > 1)
  • if called inside an attachment, it only works for the owner.

See Also

Functions

•  llRequestInventoryData

Deep Notes

All Issues

~ Search JIRA for related Issues
   llMapDestination ignores look_at parameter
   Throttle llMapDestination to prevent "map bombing".
   llMapDestination in attachments opens a map on owner's screen even when touched by someone else
   llMapDestination pos parameter is sometimes replaced with incorrect data (workaround included)
   height in pos is capped to 1000m (code patch included)

Signature

function void llMapDestination( string simname, vector pos, vector look_at );