OsLocalTeleportAgent

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Created page with "{{osslfunc |threat_level=Severe |permissions=${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER |delay=5 |additional_info= '''osTeleportAgent''' has a 0.5 second delay if ...")
 
(35 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{osslfunc
 
{{osslfunc
|threat_level=Severe
+
|threat_level=None
|permissions=${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
+
|permissions=see description
|delay=5
+
|delay=0
 
|additional_info=
 
|additional_info=
'''osTeleportAgent''' has a 0.5 second delay if the teleport is not allowed, or when the destination is to a location in the same region as the Agents current region.
+
|function_syntax= osLocalTeleportAgent(key agentID, vector newPosition, vector newVelocity, vector newLookat, integer optionFlags)
|function_syntax=void osTeleportAgent(key agent, integer regionX, integer regionY, vector position, vector lookat)<br />
+
void osTeleportAgent(key agent, string regionName, vector position, vector lookat)<br />
+
void osTeleportAgent(key agent, vector position, vector lookat)
+
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
// Example osTeleportAgent Script
 
//
 
// Set Destination as described below, There are a Few Options depending on Application:
 
// IN GRID Teleport
 
// Destination = "1000,1000"; = Using In-Grid Map XXXX,YYYY coordinates
 
// Destination = "RegionName"; = Using RegionName
 
// HyperGrid Teleport (region must be HG Enabled)
 
// Destination = "TcpIpAddr:Port:RegionName"; = Using the Target/Destination IP Address
 
// Destination = "DNSname:Port:RegionName"; = Using the Target/Detination DNSname
 
// Note: RegionName is Optionally Specified to deliver Avatar to specific region in an instance.
 
//
 
// ========================================================================================
 
// === SET DESTINATION INFO HERE ===
 
//
 
string Destination = "LBSA Plaza"; // your target destination here (SEE NEXT LINES) Can Be
 
 
vector LandingPoint = <128,128,50>; // X,Y,Z landing point for avatar to arrive at
 
vector LandingPoint = <128,128,50>; // X,Y,Z landing point for avatar to arrive at
vector LookAt = <1,1,1>; // which way they look at when arriving
+
vector TPvel = <0,0,0>;
 +
vector LookAt = <1,1,0>; // which way they look at when arriving
 +
 
 
//
 
//
 
default
 
default
 
{
 
{
  on_rez(integer start_param)
 
  {
 
    llResetScript();
 
  }
 
  changed(integer change) // something changed, take action
 
  {
 
    if(change & CHANGED_OWNER)
 
      llResetScript();
 
    else if (change & 256) // that bit is set during a region restart
 
      llResetScript();
 
  }
 
 
   state_entry()
 
   state_entry()
 
   {
 
   {
     llWhisper(0, "OS Teleportal Active");
+
     llWhisper(0, "OS Local Teleport Active");
 
   }
 
   }
 
   touch_start(integer num_detected)  
 
   touch_start(integer num_detected)  
 
   {
 
   {
 
     key avatar = llDetectedKey(0);
 
     key avatar = llDetectedKey(0);
     llInstantMessage(avatar, "Teleporting you to : "+Destination);
+
     llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint);
     osTeleportAgent(avatar, Destination, LandingPoint, LookAt);  
+
     osLocalTeleportAgent(avatar, LandingPoint, TPvel, LookAt, OS_LTPAG_USELOOKAT | OS_LTPAG_FORCEFLY);  
 
   }
 
   }
 
}</source>
 
}</source>
|description=Teleports an agent to the specified location. The first variant is able to teleport to any addressable region, including [[hypergrid]] destinations. The second variant teleports to a region in the local grid; the region coordinates are specified as region cells (not as global coordinates based on meters). The third variant teleports within the current region.
+
|description=
 
+
<div style="background-color:#FFA0A0; padding:10px; padding-bottom:5px; border: 1px #FF544F solid">
For osTeleportAgent() to work, the owner of the prim containing the script must be the same as the parcel that the avatar is currently on. If this isn't the case then the function fails silently.
+
'''Caution !''' still experimental, subject to changes
 +
</div>
 +
Teleports an avatar with uuid agentID to the specified newPosition within same region.<br>
 +
It ignores region teleport settings like Telehub or landpoint<br>
 +
<br>
 +
The avatar must have rights to enter the target position.<br>
 +
The avatar must had granted PERMISSION_TELEPORT to the script or the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on.<br>
 +
The function will fail silently if conditions are not meet.<br>
 +
<br>
 +
- If newPosition is outside the region the target will be at nearest region border.<br>
 +
- newVelocity, if selected with optionFlags bit 0 set, should set a avatar velocity, but may only work with ubOde Physics engine, even so results may be a bit unpredictable. It will stop if the avatar collides with anything at destination or if the user presses a movement key. It also has a fast decay. This behavior will need future changes. If bit 0 is not set, current velocity is kept<br>
 +
- newLookAt, if selected with optionFlags bit 1 set, changes the avatar look at direction. Bit 2 can alternatively be used to align the look at to the velocity, if that is not zero vector. Camera direction will depend on viewer camera state at teleport time (like camera attached to avatar or free). Look at is the direction the avatar head will face. Body will face close to that, depending on viewers. Look At Z component is zero. If both bits are not set, the look at direction will be the current camera direction<br>
  
See also  [[osTeleportOwner]], and if you receive an error see [[OSSL Enabling Functions|how to enable OS functions]].
+
- OptionFlags is a bit field:<br>
 +
bit 0 (OS_LTPAG_USEVEL): use newVelocity<br>
 +
bit 1 (OS_LTPAG_USELOOKAT): use newLookAt<br>
 +
bit 2 (OS_LTPAG_ALGNLV): align lookat to velocity if it is not zero vector<br>
 +
bit 3 (OS_LTPAG_FORCEFLY): force fly.<br>
 +
bit 4 (OS_LTPAG_FORCENOFLY): force no fly. Will not work if viewer has fly after teleport option set<br>
 +
<br>
 +
if both bits 1 and 2 are set bit 2 is ignored<br>
 +
if both bits 3 and 4 are set bit 4 is ignored<br>
 
|
 
|
 
}}
 
}}

Revision as of 15:42, 2 May 2019

osLocalTeleportAgent(key agentID, vector newPosition, vector newVelocity, vector newLookat, integer optionFlags)

Caution ! still experimental, subject to changes

Teleports an avatar with uuid agentID to the specified newPosition within same region.
It ignores region teleport settings like Telehub or landpoint

The avatar must have rights to enter the target position.
The avatar must had granted PERMISSION_TELEPORT to the script or the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on.
The function will fail silently if conditions are not meet.

- If newPosition is outside the region the target will be at nearest region border.
- newVelocity, if selected with optionFlags bit 0 set, should set a avatar velocity, but may only work with ubOde Physics engine, even so results may be a bit unpredictable. It will stop if the avatar collides with anything at destination or if the user presses a movement key. It also has a fast decay. This behavior will need future changes. If bit 0 is not set, current velocity is kept
- newLookAt, if selected with optionFlags bit 1 set, changes the avatar look at direction. Bit 2 can alternatively be used to align the look at to the velocity, if that is not zero vector. Camera direction will depend on viewer camera state at teleport time (like camera attached to avatar or free). Look at is the direction the avatar head will face. Body will face close to that, depending on viewers. Look At Z component is zero. If both bits are not set, the look at direction will be the current camera direction

- OptionFlags is a bit field:
bit 0 (OS_LTPAG_USEVEL): use newVelocity
bit 1 (OS_LTPAG_USELOOKAT): use newLookAt
bit 2 (OS_LTPAG_ALGNLV): align lookat to velocity if it is not zero vector
bit 3 (OS_LTPAG_FORCEFLY): force fly.
bit 4 (OS_LTPAG_FORCENOFLY): force no fly. Will not work if viewer has fly after teleport option set

if both bits 1 and 2 are set bit 2 is ignored
if both bits 3 and 4 are set bit 4 is ignored

Threat Level None
Permissions see description
Extra Delay 0 seconds
Example(s)
vector LandingPoint = <128,128,50>; // X,Y,Z landing point for avatar to arrive at
vector TPvel = <0,0,0>;
vector LookAt = <1,1,0>; // which way they look at when arriving
 
//
default
{
  state_entry()
  {
    llWhisper(0, "OS Local Teleport Active");
  }
  touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint);
    osLocalTeleportAgent(avatar, LandingPoint, TPvel, LookAt, OS_LTPAG_USELOOKAT | OS_LTPAG_FORCEFLY); 
  }
}
Personal tools
General
About This Wiki