Skip to content
lsl.devlsl.devLSL Dev

LlTeleportAgent

Looking for the current API? Open the llTeleportAgent reference →

Wiki description

Teleports an agent to a landmark stored in the object's inventory.
If landmark is an empty string, the avatar is teleported to the location position in the current region.
If the destination is in the current region, the avatar will land facing look_at as a position within that region. Otherwise, look_at is treated as a unit direction.

Caveats

  • This function can only teleport the owner of the object (unless part of an Experience).
  • Throttled experiments (August 2026) show:
    • Only 4 initial teleports can be done immediately, or
    • You can keep teleporting every 1.4 seconds.
  • If you get throttled:
    • An error is shouted on DEBUG_CHANNEL, and
    • No further teleports will succeed until 10 seconds have passed from the first throttle message.
  • Does not work in scripts within attached temp objects llAttachToAvatarTemp. Error Message is "Temporary attachments cannot request runtime permissions to teleport"
  • Sitting avatars cannot be teleported using this function. You must llUnSit them first.
  • This function does not override a parcel's teleport settings, i.e. if the parcel has a landing zone enabled the avatar will be teleported there.
  • If the script is part of an experience that the avatar has granted permission, then this function may teleport them without being the owner and it will override parcel teleport routing. See the example below.
  • When look_at is treated as a direction, a valid input should be <llCos(angle), llSin(angle), 0.0>.
    • In other words, it should be a unit vector corresponding to the avatar turning angle radians from north.

Examples

Basic example with a landmark called Destination in the object's inventory:
default
{
    touch_start(integer num_detected)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
    }

    run_time_permissions(integer perm)
    {
        if (PERMISSION_TELEPORT & perm)
        {
            llTeleportAgent(llGetPermissionsKey(), "Destination", ZERO_VECTOR, ZERO_VECTOR);
        }
    }
}
Basic example without a landmark in the object's inventory, while facing the avatar towards the center of the region:
default
{
    touch_start(integer num_detected)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
    }

    run_time_permissions(integer perm)
    {
        if (PERMISSION_TELEPORT & perm)
        {
            vector region_pos = <100, 130, 40>;
            vector look_at = <128,128,40>;
            llTeleportAgent(llGetPermissionsKey(), "", region_pos, look_at);
        }
    }
}
How to use this function in an Experience
// A SIMPLE SCRIPT that implements an Experience based teleport.
// Compile with the "Use Experience" box cnecked and an experience key you own selected.
// The prim containing this script must contain a landmark named "Landmark" in its contents
//
// If the person touching this box has not previously accepted an invitation to your experience,
// that person will be offered that opportunity when this prim is touched, and if the invitations
// is accepted, will be immediately teleported to the target of the landmark.
//
// If the toucher has previously accepted an invitation, the person will be immediately teleported
// with no interruption.
//
// The script has no safety features, e.g., will simply fail if the prim contains no landmark.
//
// Thanks to Rolig Loon for her help in figuring out how to do this
// See https://community.secondlife.com/t5/English-Knowledge-Base/Experiences-in-Second-Life/ta-p/2744686
// to read what the Lindens think is an adequate explanation of all this.

default
{
    touch_start(integer n)
    {
        llRequestExperiencePermissions(llDetectedKey(0), "");
    }

    experience_permissions(key agent)
    {
        llTeleportAgent(agent, "Landmark", ZERO_VECTOR, ZERO_VECTOR);
    }
}
Below is an example of properly handling the look_at value based on whether the destination is the current region or a different one. This ensures that the avatar will always be facing the same direction regardless of whether they're teleporting within the region or to another one.
The script keeps track of the landmark's destination coordinate in the state_entry and changed events, which is later used to calculate the total distance of the teleport.
string landmark;
vector destination;

default
{
    state_entry()
    {
        // Get data about the first landmark in object inventory when script starts.
        if (llGetInventoryNumber(INVENTORY_LANDMARK) > 0) {
            landmark = llGetInventoryName(INVENTORY_LANDMARK, 0);
            llRequestInventoryData(landmark);
        }
    }

    changed(integer change)
    {
        if (!(change & (CHANGED_INVENTORY|CHANGED_REGION))) return;

        // Get data about the first landmark in object inventory when inventory changes.
        if (llGetInventoryNumber(INVENTORY_LANDMARK) > 0) {
            landmark = llGetInventoryName(INVENTORY_LANDMARK, 0);
            llRequestInventoryData(landmark);
        }
    }

    dataserver(key query, string data)
    {
        // Save llRequestInventoryData response.
        destination = (vector)data;
    }

    touch_start(integer num_detected)
    {
        llRequestPermissions(llGetOwner(), PERMISSION_TELEPORT);
    }

    run_time_permissions(integer perm)
    {
        if (!(PERMISSION_TELEPORT & perm)) return;

        float angle = 45 * DEG_TO_RAD;

        // When teleporting to another region, we need a direction vector.
        vector look_at = <llCos(angle), llSin(angle), 0>;

        float sim_size = llVecMag(<1,1,1>);
        float distance = llVecDist(<1,1,1>, destination / 256);

        if (distance < sim_size) {
            // When teleporting within the current region, we should use a position within the region instead.
            look_at = destination + look_at;
        }

        llTeleportAgent(llGetPermissionsKey(), landmark, ZERO_VECTOR, look_at);
    }
}
Another example, submitted by Jesse Barnett, shows how to use a list of landmarks inside a HUD to allow teleporting, even inside a no-script area: Teleport HUD.

See also: functions

History

Date of Release 24/07/2012

Shared wiki helpers

The original page also injects shared parameter notes, caveats or issue information through these helpers. Their conditional MediaWiki logic is not reproduced here; inspect the preserved helper source for additional material.

Template:LSL Function/avatar

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<noinclude>{{Multi-lang|category=LSL}}</noinclude>{{#if:

{{#vardefine:p_{{{1|none}}}_desc|avatar {{#if:{{{group|}}}|or group}} {{HoverLink|UUID|Universally Unique Identifier}} {{#if:{{{sim|}}}{{{region|}}}|that is in the same [[region]] {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region{{Footnote|handle=known}}}}}}}}

{{#vardefine:p_{{{1|none}}}_hover|avatar {{#if:{{{group|}}}|or group}} UUID {{#if:{{{sim|}}}{{{region|}}}|that is in the same region {{#ifeq:{{{sim|}}}{{{region|}}}|known|or is otherwise known to the region}}}}}}

<includeonly>
{{#if:{{{nc|}}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||{{LSLC|Avatar/As A Parameter||{{#var:lang}}}}}}
}}}}
</includeonly>

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|p_{{{1|none}}}_desc}}
|-
{{VarPair|p_{{{1|none}}}_hover}}
|}
</noinclude>

Template:LSL Function/inventory

Original shared helper source (conditional wiki logic is not evaluated)
{{LSL Injection Test}}<includeonly>{{#if:
{{:DEBUG_CHANNEL}}

{{#vardefine:p_{{{1|none}}}_desc|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the {{LSLGC|Inventory|inventory}} {{#if:{{{remote|}}}|of the {{#if:{{{target|}}}|[[{{{target|}}}|target]]|target}} prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,|&#32;or}} a {{HoverLink|UUID|Universally Unique IDentifier}}{{#if:{{{type|}}}|&#32;of {{AAn|{{{type}}}}}}}}}{{#if:{{{empty|}}}|&#32;or an empty string{{#ifeq:{{{empty}}}|*||&#32;{{{empty}}}}}}}{{#var:p_{{{1|none}}}_desc}}}}

{{#vardefine:p_{{{1|none}}}_hover|{{AAn|{{#if:{{{insert|}}}|{{{insert}}}|{{#if:{{{type|}}}|{{{type}}}|item}}}}}} in the inventory {{#if:{{{remote|}}}|of the target prim|of the prim this script is in}}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|{{#if:{{{empty|}}}|,|&#32;or}} a UUID{{#if:{{{type|}}}|&#32;of {{AAn|{{{type}}}|{{{type_hover|{{{type}}}}}}}}}}}}{{#if:{{{empty|}}}|&#32;or an empty string{{#ifeq:{{{empty}}}|*||&#32;{{{empty_hover|{{{empty}}}}}}}}}}{{#var:p_{{{1|none}}}_hover}}}}

{{#vardefine:caveats{{#var:direction}}|{{#if:{{#if:{{{no_caveat|}}}||{{{1|}}}}}|{{#var:caveats{{#var:direction}}}}
{{#if:{{{empty|}}}|* If {{LSLP|{{{1}}}}} is not an empty string and...
**{{LSLP|{{{1}}}}} is missing from the prim&#39;s inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}.
|* If {{LSLP|{{{1}}}}} is missing from the prim&#39;s inventory {{#if:{{{full|}}}|or not {{HoverLink|:Category:LSL_Permissions/Asset|copy, mod and transfer|full permissions}}}} {{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|and it is not a {{HoverLink|UUID|Universally Unique IDentifier}}}} {{#if:{{{type|}}}|or it is not {{AAn|{{{type|item}}}}}}} then {{#if:{{{silent|}}}|it fails silently|an error is shouted on {{#var:DEBUG_CHANNEL}}}}. }}{{#ifeq:{{{uuid|}}}{{{UUID|}}}|true|
* If {{LSLP|{{{1}}}}} is a {{HoverLink|UUID|Universally Unique IDentifier}} then there are no new [[:Category:LSL_Permissions/Asset|asset permissions]] consequences for the object.
** The resulting object develops no new usage restrictions that might have occurred if the asset had been placed in the prims inventory.}}|{{#var:caveats{{#var:direction}}}}}}}}

{{{{#if:{{{volume|}}}|LSL Function/volume}}|{{{volume|}}}|}}

}}</includeonly><noinclude>
{{Multi-lang}}
{{UpdateLink}}

{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=true}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}

{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=sound|uuid=false}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}

{| {{Prettytable}} {{#vardefine:caveats}}{{#vardefine:p_ta_desc}}{{#vardefine:p_ta_hover}}
|+<code><nowiki>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}</nowiki></code>{{{{FULLPAGENAMEE}}|ta|type=landmark|uuid=true|empty=(for teleporting within the same region)}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|caveats}}
|-
{{VarPair|p_ta_desc}}
|-
{{VarPair|p_ta_hover}}
|}

</noinclude>

Template:Issues/BUG-4062

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|BUG-4062|[[llTeleportAgent]]() and [[llTeleportAgentGlobalCoords]]() can break any script in any [[attachment|attached]] object that contains a [[changed]] event.|type=bug|resolution=fixed}}

Template:Issues/SVC-7987

Original shared helper source (conditional wiki logic is not evaluated)
{{Issues|SVC-7987|llTeleportAgent always points in the positive Y direction on teleport|type=bug|resolution=wont}}

Template:LSLP

Original shared helper source (conditional wiki logic is not evaluated)
{{LSLPT|{{{1|}}}|{{{2|}}}|{{{3|}}}}}<noinclude>

Same exact syntax as [[Template:LSL Param]].
</noinclude>

Template:LSL Function/permission

Original shared helper source (conditional wiki logic is not evaluated)
{{#if:

{{{{#if:{{#var:DEBUG_CHANNEL}}||:DEBUG_CHANNEL}}|}}

{{#vardefine:header_footnote|{{#var:header_footnote}}{{#if:{{{1|<noinclude>*</noinclude>}}}|To run this function the script must request the [[{{{1}}}]] {{#if:{{{2|}}}|or [[{{{2}}}]]}} permission with [[llRequestPermissions]]{{#ifeq:{{{grant|anyone}}}|anyone||&#32;and it must be granted by {{{grant|anyone}}}}}.}}}}

{{#vardefine:caveats|{{#var:caveats}}{{#if:{{{1|<noinclude>*</noinclude>}}}|{{PBR}}
<div style="border: 1px dotted rgba(0,0,0,0.5);">{{Collapsible_Table/Simple|title=<h5 style="margin:0;">Permissions</h5>|table-style=width:100%;|autocollapse=*|content={{!}}<div>
* Do not depend upon the auto-grant status of permissions. '''Always''' use the [[run_time_permissions]] event.
* If the script lacks {{#if:{{{2|}}}|both the permissions [[{{{1}}}]] and [[{{{2}}}]]|the permission [[{{{1}}}]]}}, the script will shout an error on {{#var:DEBUG_CHANNEL}} and the operation fails (but the script continues to run).{{#ifeq:{{{grant|anyone<noinclude>*</noinclude>}}}|anyone||
* If [[{{{1}}}]] {{#if:{{{2|}}}|or [[{{{2}}}]]}} is granted by anyone other than {{{grant|anyone}}}, then when the function is called an error will be shouted on {{#var:DEBUG_CHANNEL}}.}}
{{{caveats|}}}{{LSL Function/permission/caveat switch|{{{1}}}}}{{#if:{{{2|}}}|{{LSL Function/permission/caveat switch|{{{2}}}}}}}</div>}}</div>}}}}

{{#vardefine:also_events|{{#var:also_events}}
{{LSL DefineRow||[[run_time_permissions]]|Permission receiving event}}}}
{{#vardefine:also_functions|{{#var:also_functions}}
{{LSL DefineRow||[[llGetPermissions]]|Get the permissions granted}}
{{LSL DefineRow||[[llGetPermissionsKey]]|Get the agent who granted permissions}}
{{LSL DefineRow||[[llRequestPermissions]]|Request permissions}}}}
{{#vardefine:also_articles|{{#var:also_articles}}
{{LSL DefineRow||[[:Category:LSL Permissions/Script|Script permissions]]|}}}}

<includeonly>{{#if:{{{nc|}}}||{{#vardefine:hidden-text|{{#var:hidden-text}}
{{#if:{{#pos:{{#var:moded}}|r}}{{#pos:{{#var:moded}}|u}}||[[Category:LSL Requires Permissions]]}}
}}}}</includeonly>

}}<noinclude>
{| {{Prettytable}}
|-{{Hl2}}
! #var
! value
|-
{{VarPair|header_footnote}}
|-
{{VarPair|caveats}}
|-
{{VarPairTable|also_events}}
|-
{{VarPairTable|also_functions}}
|-
{{VarPairTable|also_articles}}
|}
</noinclude>
Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.