Difference between revisions of "LlTeleportAgent"

From Second Life Wiki
Jump to navigation Jump to search
Line 1: Line 1:
{{KBwarning|This function is still under development and is subject to change at any time.}}
{{LSL_Function
{{LSL_Function
|func_id|mode=request
|func_sleep=0.0
|func_energy=10.0
|func=llTeleportAgent
|func=llTeleportAgent
|sort=TeleportAgent
|sort=TeleportAgent
|p1_type=key|p1_name=avatar|p1_desc=The key of the avatar for which to request a teleport.
|p1_type=key|p1_name=avatar|p1_desc=The key of the avatar for which to request a teleport.
|p2_type=string|p2_name=region|p2_desc=The region to teleport the avatar to. Provide with an empty string, or the name of the current region, for a local teleport.
|p2_type=string|p2_name=landmark|p2_desc=The name of a landmark in the object's inventory; landmarks may be used to teleport to any valid location in Second Life. This string may be left blank for teleporting within the same region.
|p3_type=vector|p3_name=pos|p3_desc=The position within the region to teleport the avatar to. If the value of the X or Y component is less than 0.0 or greater than or equal to 256.0, then a local teleport will become a global one.
|p3_type=vector|p3_name=position|p3_desc=The position within the local region to teleport the avatar to if no landmark was provided.
|p4_type=vector|p4_name=look_at|p4_desc=The position within the region that the avatar should be turned to face upon arrival.
|p4_type=vector|p4_name=look_at|p4_desc=The position within the target region that the avatar should be turned to face upon arrival.
|func_desc=Requests a teleport of <code>avatar</code> to location <code>pos</code> within <code>region</code>, turning the avatar to face the position given by <code>look_at</code>. Providing an empty string for <code>region</code> requests a local teleport, and is identical to explicitly providing the name of the current region.
|func_desc=Requests a teleport of <code>avatar</code> to a <code>landmark</code> stored in the object's inventory.  If no landmark is provided (an empty string), the avatar is teleported to the location <code>position</code> in the current region. In either case, the avatar is turned to face the position given by <code>look_at</code> in local coordinates.
|return_text
|func_footnote=This call requires [[PERMISSION_TELEPORT]], which must be requested with [[llRequestPermissions]].
|spec
|caveats=* Use of this call requires the target avatar to have granted [[PERMISSION_TELEPORT]], which must be requested using [[llRequestPermissions]].
|caveats=* This function sends requests to an agent's viewer, compatible with calls to [[llMapDestination]]() in unsupported viewers.
* Sitting avatars cannot be teleported using this function.
* By default, viewers that permit automatic teleportation will do so if:
|examples=
** The scripted object is worn by the avatar being teleported.
'''Without a landmark in the object's inventory'''
** The scripted object belongs to the land-owner of the parcel that the avatar is currently within, and the requested teleport is a local one.
<lsl>key teleportee;
* Other requests, or all requests for viewers that have disabled automatic teleportation, will trigger a dialogue giving details of the teleport request.
* This function is throttled at 10 requests per every 30 seconds by the simulator, and 1 per every 20 seconds in supported viewers.
|examples=<lsl>default {
    key teleportedAgent;


     touch_start(integer x) {
default
         llTeleportAgent(teleportedAgent = llDetectedKey(0), "", <128.0, 128.0, 25.0>, <129.0, 128.0, 25.0>);
{
        llSetTimerEvent(30.0);
     state_entry()
    {
         llSay(0, "Touch to teleport");
     }
     }


     timer() {
     touch_start(integer total_num)
         // Is the teleported avatar still nearby?
    {
        vector pos = llList2Vector(llGetObjectDetails(teleportedAgent, [OBJECT_POS]), 0);
         teleportee = llDetectedKey(0);
         if ((pos == ZERO_VECTOR) || (llVecDist(llGetPos(), pos) > 10.0)) {
         llRequestPermissions(teleportee, PERMISSION_TELEPORT);
            // Teleport request appears to have been accepted
    }
         } else {
   
             // Teleport request appears to have been refused
    run_time_permissions(integer perm)
    {
        if(PERMISSION_TELEPORT & perm)
         {
             llTeleportAgent(teleportee, "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);
         }
         }
    }
}
</lsl>
'''With a landmark in the objects inventory'''
<lsl>
key  teleportee;
default
{
    state_entry()
    {
        llSay(0, "Touch to teleport");
    }


         llSetTimerEvent(0.0);
    touch_start(integer total_num)
    {
        teleportee = llDetectedKey(0);
        llRequestPermissions(teleportee, PERMISSION_TELEPORT);
    }
   
    run_time_permissions(integer perm)
    {
        if(PERMISSION_TELEPORT & perm)
         {
            llTeleportAgent(teleportee, "Experience Tools 1", <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>);
        }
     }
     }
}</lsl>
}
|helpers
</lsl>
|related
|also_functions= *[[llRequestPermissions]]
|also
|notes=
|notes=This would be extremely useful in complex builds such as Stargates, HUDS and other teleportation creations.
* <code>look_at</code> is included to match [[llMapDestination]]'s still pending <code>look_at</code> functionalty (see {{jira|VWR-23580}}).
*  See {{jira|SVC-212}} for the JIRA listing for this function.
}}
}}

Revision as of 14:25, 29 May 2012

KBwarning.png Warning: This function is still under development and is subject to change at any time.

Summary

Function: llTeleportAgent( key avatar, string landmark, vector position, vector look_at );

Requests a teleport of avatar to a landmark stored in the object's inventory. If no landmark is provided (an empty string), the avatar is teleported to the location position in the current region. In either case, the avatar is turned to face the position given by look_at in local coordinates.

• key avatar The key of the avatar for which to request a teleport.
• string landmark The name of a landmark in the object's inventory; landmarks may be used to teleport to any valid location in Second Life. This string may be left blank for teleporting within the same region.
• vector position The position within the local region to teleport the avatar to if no landmark was provided.
• vector look_at The position within the target region that the avatar should be turned to face upon arrival.

This call requires PERMISSION_TELEPORT, which must be requested with llRequestPermissions.

Caveats

All Issues ~ Search JIRA for related Bugs

Examples

Without a landmark in the object's inventory <lsl>key teleportee;

default {

   state_entry()
   {
       llSay(0, "Touch to teleport");
   }
   touch_start(integer total_num)
   {
       teleportee = llDetectedKey(0);
       llRequestPermissions(teleportee, PERMISSION_TELEPORT);
   }
   
   run_time_permissions(integer perm)
   {
       if(PERMISSION_TELEPORT & perm)
       {
           llTeleportAgent(teleportee, "", <13.0, 38.0, 23.5>, <13.0, 12.0, 23.5>);
       }
   }

} </lsl> With a landmark in the objects inventory <lsl> key teleportee;

default {

   state_entry()
   {
       llSay(0, "Touch to teleport");
   }
   touch_start(integer total_num)
   {
       teleportee = llDetectedKey(0);
       llRequestPermissions(teleportee, PERMISSION_TELEPORT);
   }
   
   run_time_permissions(integer perm)
   {
       if(PERMISSION_TELEPORT & perm)
       {
           llTeleportAgent(teleportee, "Experience Tools 1", <0.0, 0.0, 0.0>, <0.0, 0.0, 0.0>);
       }
   }

}

</lsl>

See Also

Deep Notes

Search JIRA for related Issues

Signature

function void llTeleportAgent( key avatar, string landmark, vector position, vector look_at );