Difference between revisions of "LlMapDestination"

From Second Life Wiki
Jump to navigation Jump to search
m (added line-break for better readability for not so wide displays)
 
(5 intermediate revisions by 4 users not shown)
Line 2: Line 2:
|inject-2={{Issues/SVC-3455}}{{Issues/SVC-1038}}{{Issues/SVC-1795}}{{Issues/VWR-2060}}{{Issues/VWR-7331}}
|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|pos|region=*}}
{{LSL Function/position|look_at|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
Line 16: Line 16:
|constants
|constants
|examples=
|examples=
<lsl>
<syntaxhighlight lang="lsl2">
string simName = "Help Island Public";
string simName = "Help Island Public";
vector tpDest = <128.0, 128.0, 24.0>;
vector tpDest = <128.0, 128.0, 24.0>;
Line 33: Line 33:
         key id = llDetectedKey(0);
         key id = llDetectedKey(0);


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


         llInstantMessage(id, old_slurl_prefix + slurl_suffix);
         llInstantMessage(id, oldSlurlPrefix + slurlSuffix);
         llInstantMessage(id, new_slurl_prefix + slurl_suffix);
         llInstantMessage(id, newSlurlPrefix + slurlSuffix);


         llMapDestination(simName, tpDest, lookAt);
         llMapDestination(simName, tpDest, lookAt);
     }
     }
}
}
</lsl>
</syntaxhighlight>
|helpers
|helpers
|also_functions=
|also_functions=
{{LSL DefineRow||[[llRequestInventoryData]]|}}
{{LSL DefineRow||[[llRequestInventoryData]]|}}
{{LSL DefineRow||[[llMapBeacon]]|}}
|also_tests
|also_tests
|also_events
|also_events
Line 56: Line 57:
* {{LSLP|pos}} will work with [[Viewer_coordinate_frames#Region|Region]] coordinates not inside {{LSLP|simname}}. (like those returned by [[llRequestInventoryData]])
* {{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 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 from touch, it may only work for the first or last touch in the event queue (example: {{Mono|num_touched > 1}})
* if called inside an [[attachment]], it only works for the owner.
* if called inside an [[attachment]], it only works for the owner.
|permission
|permission

Latest revision as of 12:36, 14 October 2024

Summary

Function: llMapDestination( string simname, vector pos, vector look_at );
1.0 Forced Delay
10.0 Energy

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.

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
•  llMapBeacon

Deep Notes

Signature

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