OsTeleportAgent

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(added additional reference links)
m (Minor edit to script to use CHANGED_REGION_START instead of 256)
 
(41 intermediate revisions by 12 users not shown)
Line 1: Line 1:
Example Script for Teleporting Agent using osTeleportAgent.
+
{{osslfunc
 
+
|threat_level=Severe
Syntax:  osTeleportAgent(key UUID, string "DestinationTarget", vector LandingZone, vector LookAt)  
+
|permissions=${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
 
+
|delay=0.5
This must be Activated / Allowed in OpenSim.ini for operation. 
+
|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. A teleport to other region has a 5 second delay<br>
Please refer to [[OSSL_Enabling_Functions]]&nbsp; &amp;&nbsp;&nbsp; [[OSSL_Implemented]]
+
For teleports within region, in particular NPC agents, consider using [[osLocalTeleportAgent]]
 
+
|function_syntax= osTeleportAgent(key agent, string regionName, vector position, vector lookat)<br />
 
+
osTeleportAgent(key agent, integer regionX, integer regionY, vector position, vector lookat)<br />
 
+
osTeleportAgent(key agent, vector position, vector lookat)
<source lang="ini">// Example osTeleportAgent Script
+
|ossl_example=<source lang="lsl">
 +
// Example osTeleportAgent Script
 
//
 
//
 
// Set Destination as described below, There are a Few Options depending on Application:
 
// Set Destination as described below, There are a Few Options depending on Application:
Line 24: Line 25:
 
//
 
//
 
string Destination = "LBSA Plaza"; // your target destination here (SEE NEXT LINES) Can Be
 
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.0, 128.0, 50.0>; // X,Y,Z landing point for avatar to arrive at
vector LookAt = <1,1,1>; // which way they look at when arriving
+
vector LookAt = <0.0, 1.0, 0.0>; // which way they look at when arriving
 
//
 
//
 
default
 
default
 
{
 
{
on_rez(integer start_param)
+
  on_rez(integer start_param)
{
+
  {
llResetScript();
+
    llResetScript();
}
+
  }
changed(integer change) // something changed, take action
+
  changed(integer change) // something changed, take action
{
+
  {
if(change & CHANGED_OWNER)
+
    if(change & CHANGED_OWNER)
{
+
      llResetScript();
llResetScript();
+
    else if (change & CHANGED_REGION_START) // that bit is set during a region restart
}
+
      llResetScript();
else if (change & 256) // that bit is set during a region restart
+
  }
{
+
  state_entry()
llResetScript();
+
  {
}
+
    llWhisper(0, "OS Teleportal Active");
}
+
  }
+
  touch_start(integer num_detected)  
state_entry()
+
  {
{
+
    key avatar = llDetectedKey(0);
llWhisper(0, "OS Teleportal Active");
+
    llRegionSayTo(avatar, 0,"Teleporting you to : "+Destination);
}
+
    osTeleportAgent(avatar, Destination, LandingPoint, LookAt);  
+
  }
touch_start(integer num_detected)  
+
}
{
+
</source>
key avatar = llDetectedKey(0);
+
<source lang="lsl">
llInstantMessage(avatar, "Teleporting you to : "+Destination);
+
//
osTeleportAgent(avatar, Destination, LandingPoint, LookAt);  
+
// Example teleport to region at west, 10m from the border to current and facing west
}
+
//
 +
default
 +
{
 +
  state_entry()
 +
  {
 +
    llOwnerSay("OS Teleportal Active");
 +
  }
 +
  touch_start(integer num_detected)
 +
  {
 +
    key avatar = llDetectedKey(0);
 +
    vector pos = llGetPos();
 +
    llRegionSayTo(avatar, 0, "Teleporting you there");
 +
    osTeleportAgent(avatar, <-10, pos.y, pos.z + 1>,<-1,0,0>);
 +
  }
 
}</source>
 
}</source>
 +
|description=Teleports an agent to the specified location<br>
 +
* position is the location relative to destination region reference corner<br>
 +
* lookAt is the direction the avatar should look. Z value is ignored. For example to face north use <0,1,0><br>
 +
 +
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. Since version 0.9.2.0 it can also teleport to a nearby region if position does point to one
 +
 +
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.
 +
 +
See also  [[osTeleportOwner]], and if you receive an error see [[OSSL Enabling Functions|how to enable OS functions]].
 +
|
 +
}}

Latest revision as of 08:30, 16 July 2022

osTeleportAgent(key agent, string regionName, vector position, vector lookat)

osTeleportAgent(key agent, integer regionX, integer regionY, vector position, vector lookat)
osTeleportAgent(key agent, vector position, vector lookat)

Teleports an agent to the specified location
  • position is the location relative to destination region reference corner
  • lookAt is the direction the avatar should look. Z value is ignored. For example to face north use <0,1,0>

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. Since version 0.9.2.0 it can also teleport to a nearby region if position does point to one

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.

See also osTeleportOwner, and if you receive an error see how to enable OS functions.

Threat Level Severe
Permissions ${OSSL|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Extra Delay 0.5 seconds
Example(s)
// 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.0, 128.0, 50.0>; // X,Y,Z landing point for avatar to arrive at
vector LookAt = <0.0, 1.0, 0.0>; // which way they look at when arriving
//
default
{
  on_rez(integer start_param)
  {
    llResetScript();
  }
  changed(integer change) // something changed, take action
  {
    if(change & CHANGED_OWNER)
      llResetScript();
    else if (change & CHANGED_REGION_START) // that bit is set during a region restart
      llResetScript();
  }
  state_entry()
  {
    llWhisper(0, "OS Teleportal Active");
  }
  touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    llRegionSayTo(avatar, 0,"Teleporting you to : "+Destination);
    osTeleportAgent(avatar, Destination, LandingPoint, LookAt); 
  }
}
//
// Example teleport to region at west, 10m from the border to current and facing west
//
default
{
  state_entry()
  {
    llOwnerSay("OS Teleportal Active");
  }
  touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    vector pos = llGetPos();
    llRegionSayTo(avatar, 0, "Teleporting you there");
    osTeleportAgent(avatar, <-10, pos.y, pos.z + 1>,<-1,0,0>); 
  }
}
Notes
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. A teleport to other region has a 5 second delay

For teleports within region, in particular NPC agents, consider using osLocalTeleportAgent

Personal tools
General
About This Wiki