OsLocalTeleportAgent

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
Line 6: Line 6:
 
|function_syntax=void osLocalTeleportAgent(key agent, vector position, vector newVelocity, vector newLookat, integer flags)
 
|function_syntax=void osLocalTeleportAgent(key agent, vector position, vector newVelocity, vector newLookat, integer flags)
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
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 LookAt = <1,1,1>; // which way they look at when arriving
Line 30: Line 29:
 
   {
 
   {
 
     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, ZEROVECTOR, <0,1,0>, 2);  
 
   }
 
   }
 
}</source>
 
}</source>
Line 37: Line 36:
 
For osLocalTeleportAgent() to work, the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on. The Avatar must have rights to enter the target position.  If this isn't the case then the function fails silently. Flags is a bit field:<br>
 
For osLocalTeleportAgent() to work, the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on. The Avatar must have rights to enter the target position.  If this isn't the case then the function fails silently. Flags is a bit field:<br>
 
bit 0: use newVelocity / keep current <br>
 
bit 0: use newVelocity / keep current <br>
bit 1: use newLookAt <br>;
+
bit 1: use newLookAt <br>
 
bit 2: align lookat to velocity if not zero<br>
 
bit 2: align lookat to velocity if not zero<br>
 
bit 3: fly<br>
 
bit 3: fly<br>
 
bit 4: do not fly<br>
 
bit 4: do not fly<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 14:22, 1 May 2019

void osLocalTeleportAgent(key agent, vector position, vector newVelocity, vector newLookat, integer flags)
Teleports an agent to the specified location within same region.

For osLocalTeleportAgent() to work, the owner of the prim containing the script must also be owner of the parcel where the avatar is currently on. The Avatar must have rights to enter the target position. If this isn't the case then the function fails silently. Flags is a bit field:
bit 0: use newVelocity / keep current
bit 1: use newLookAt
bit 2: align lookat to velocity if not zero
bit 3: fly
bit 4: do not fly

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 Severe
Permissions ${XEngine|osslParcelO}ESTATE_MANAGER,ESTATE_OWNER
Delay 5 seconds
Example(s)
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
//
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()
  {
    llWhisper(0, "OS Teleportal Active");
  }
  touch_start(integer num_detected) 
  {
    key avatar = llDetectedKey(0);
    llInstantMessage(avatar, "Teleporting you to : " + (string)LandingPoint);
    osLocalTeleportAgent(avatar, LandingPoint, ZEROVECTOR, <0,1,0>, 2); 
  }
}
Personal tools
General
About This Wiki