llMapDestination

From Second Life Wiki
Revision as of 14:49, 23 September 2012 by Kireji Haiku (talk | contribs) (added line-break for better readability for not so wide displays)
Jump to navigation Jump to search

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 region 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

<lsl> 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 old_url_prefix = "http://slurl.com/secondlife/";
       string new_url_prefix = "http://maps.secondlife.com/secondlife/";
       string url_suffix = llEscapeURL(simName)
           + "/" + (string)llRound(tpDest.x)
           + "/" + (string)llRound(tpDest.y)
           + "/" + (string)llRound(tpDest.z);
       llInstantMessage(id, old_slurl_prefix + slurl_suffix);
       llInstantMessage(id, new_slurl_prefix + slurl_suffix);
       llMapDestination(simName, tpDest, lookAt);
   }

}

</lsl>

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