Simple Teleport Script

From Kimm Paulino:

// Teleports on 'left click' (touch).
//
// Set the coordinates to tp to in the DEST= line after these comments.
//
//  Kimm Paulino
//  Sept 2009
//
// Teleport bit based on the following:
//
// Copyright (c) 2008, Scripting Your World
// All rights reserved.
//
// Scripting Your World
// By Dana Moore, Michael Thome, and Dr. Karen Zita Haigh
// http://syw.fabulo.us
// http://www.amazon.com/Scripting-Your-World-Official-Second/dp/0470339837/
//
// You are permitted to use, share, and adapt this code under the 
// terms of the Creative Commons Public License described in full
// at http://creativecommons.org/licenses/by/3.0/legalcode.
// That means you must keep the credits, do nothing to damage our
// reputation, and do not suggest that we endorse you or your work.
//
// Listing 2.4: Teleport3 - Optimized Intrasim Teleport
 
vector DEST = <224 , 213, 22>; // the teleport will be to this location
vector SITPOS = <0,0,0.5>;
key gAv;
 
moveTo(vector origin, vector destination ) { // removed jumpdist
    float dist = llVecDist(origin, destination);
    integer passes = llCeil( llLog(dist/10.0) / llLog(2.0) );
    integer i;
    list params = [PRIM_POSITION, destination];
    for (i=0; i

 

1000m Menu-Driven Intra-Sim Teleporter

////////////////////////////////////////////////////////////////
// 1000m Menu-driven Intra-Sim Teleporter
// By Nepenthes Ixchel
// July 2006

/////////////////////////////////////////////////////////////////
// License:
// This code is released into the public domain, but if you sell
// it without making any changes to add value to it then hordes of
// purple undead monkeys will torment you in the afterlife.
//
// This code is released without any warranty of any sort.
//
// Code in this script includes:
//
// WarpPos by Keknehv Psaltery, April 2006, Public Domain
// This provides the instant movement code.
//
// Single Neat Elevator by Seagul Neville, Dec 2005, Public Domain
// This script started as SN_Elevator, but I don't think much
// of the original code survived. :-)

/////////////////////////////////////////////////////////////////
// Design:
//
// Menu system sets target location from pre-defined list
// When a user sits on the object it moves to the target location,
// unists the avatar, and returns. Use of WarpPos by Keknehv
// Psaltery makes this possible beyond the 10 metre limit normally
// associated with position changes.

/////////////////////////////////////////////////////////////////
// Quirks:
//
// If you move the teleporter after placing it you need to
// reset this script so it learns it's new home position
//
// All target locations must be under 768m in height
//
// All target locations must be in teh same sim as teh teleport
//
// Max distance is 1000m... but it's impossible to move more than
// 850m in a single sim without going higher than 768m.
//
// If use of llSetPrimitiveParams to bypass the 10m movement
// restriction is ever nerfed then this script will stop working.


/////////////////////////////////////////////////////////////////
// Usage
//
// Edit the list of locations.
// Place script in a prim
// Touch to get a menu to set destination
// Right click -> sit to teleport

/////////////////////////////////////////////////////////////////
//user variables, you should set these.

// A list of locations (names and position)
// This is for one sim only; teh sim the teleporter is in.
// No more than 12 locations or you'll get an error from llDialog
// Buttons are drawn left to right, bottom to top, in row of three.
list gLocations=[
"New Releases",<155 ,155,102>,
"Playful Kitten",<155 ,155,115>,
"Boneflower",<155 ,155,127>,
"IMD",<155 ,168,138>,
"Cyber Apoc",<164 ,52,27>,
"Pirate Kitty",<36 ,32,21>,
"Telehub",<155 ,108,106>,
"Shrine",<29 ,178,27>,
"Moon",<184 ,143,147>
];

// Text for the "pie menu"
string gSitText="Teleport";
// If you don't enable this teh teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
// Alpha for hovertext
float gTextAlpha=0.5;
// colour for hovertext
vector gTextColour=<1 .0,1.0,1.0>;


/////////////////////////////////////////////////////////////////
//Runtime variables. You should leave these alone.

vector gStartPos=<0,0,0>;
key gAvatarID=NULL_KEY;
integer gChannel=574368374;
vector gTargetPos=<0,0,0>;


//////////////////////////////////////////////////////////////////
// Function for instant intra-sim movement

warpPos( vector d ) //R&D by Keknehv Psaltery, ~05/25/2006
{
if ( d.z > 768 ) //Otherwise we'll get stuck hitting the ceiling
d.z = 768;
//The number of jumps necessary
integer s = (integer)(llVecMag(d-llGetPos())/10)+1;
//Try and avoid stack/heap collisions
if ( s > 100 )
s = 100; // 1km should be plenty
//Solve '2^n=s'
integer e = (integer)( llLog( s ) / llLog( 2 ) );
list rules = [ PRIM_POSITION, d ]; //The start for the rules list
integer i;
for ( i = 0 ; i  0 ) //Finish it up
rules += llList2List( rules, 0, r * 2 + 1 );
llSetPrimitiveParams( rules );
}

//////////////////////////////////////////////////////////////////
// Main codeblock.

default
{
state_entry() {
llSetSitText(gSitText);
gStartPos = llGetPos();
llSitTarget(<0,0,1>,ZERO_ROTATION);
gChannel=(integer)llFrand(1000000000)+1000000000;
llSetText(llList2String(gLocations,0),gTextColour, gTextAlpha);
gTargetPos=(llList2Vector(gLocations,1));
llListen(gChannel,"",NULL_KEY,"");
}
on_rez(integer start_param){
llResetScript();
}
changed(integer change){
if(change & CHANGED_LINK)
{
gAvatarID = llAvatarOnSitTarget();
if(gAvatarID != NULL_KEY)
{
warpPos(gTargetPos);
llSleep(1);
llUnSit(gAvatarID);
llSleep(1);

if (gReturnToStartPos){
warpPos(gStartPos);
}
}
}
}

touch_start(integer number){
list options=[];
integer i =0;
for(i=0;i

 

Teleport

key lastAVkey = NULL_KEY;
string fltText = "Teleportation Script";
vector dest = <17 .144,154.847,26.836>;
default
{
    state_entry()
    {
        llSetSitText("Teleport");
        llSetText(fltText, <1 ,1,1>, 1);
        llSitTarget(dest-llGetPos(), <0,0,0,1>);
    }
    touch_start(integer i)
    {
        llSay(0,"Right click me and chose 'Teleport'");
    }
    changed(integer change)
    {
        key currentAVkey = llAvatarOnSitTarget();
        if (currentAVkey != NULL_KEY && lastAVkey == NULL_KEY)
        {
            lastAVkey = currentAVkey;        
            if (!(llGetPermissions() & PERMISSION_TRIGGER_ANIMATION))  
                llRequestPermissions(currentAVkey,PERMISSION_TRIGGER_ANIMATION);
            llUnSit(currentAVkey);
            llStopAnimation("sit");
            llResetScript();
        }
    }
}

 

Teleportation

vector targetPos = <13 , 119, 40>; //The target location

reset()
{
    vector target;
    
    target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
    llSitTarget(target, ZERO_ROTATION);
    llSetSitText(llGetObjectName());
}
default
{
    state_entry()
    {
        reset();
    }
    
    on_rez(integer startup_param)
    {
        reset();
    }
    
    changed(integer change)
    {
        llUnSit(llAvatarOnSitTarget());
        reset();
    }    
}

 

Self Sims Teleport

Great for combat sims when you mlandmarks wornt work you you need a quick way to tp to a new location.  This can be used in a HUD.  This was written by Mulligan Silversmith

How to use:

Simply click on hud

Main_menu ( first option when clicked on)
  • Save  ( Save position Option)
  • Go To ( Teleport Options)

Save Options

  • Save 1 ( This will save a first point)
  • Save 2 ( This will save a second point)

Go To

  • Go 1 ( This will teleport you to your first saved point)
  • Go 2 ( This will teleport you to your second saved point)

How it Works:

The way it teleports you is it pushes the objected and when its wear by someone it pushes that person.

It goes throughSmiley Tonguelayers/Buildings/Solid Ground

  • You can change how fast it goes but be warned it could crash you. It also doesn't have a limit on how high it goes.. I setup to 999999 Feet and it worked kinda slow but worked

Known Problems:

  • Setting the "Movement" speed too fast could crash you
  • I wouldn't use on a laggy sims
  • Only works on one sims

 

/*  
    Sims Self Teleport v1.0
*/
integer menuChannel = 5666;             // What Channel the script listens too.
integer FASTGO = TRUE;                  // Used to see if main in fast mode or not
vector position_01;                     // The saved position.
vector position_02;                     // The saved position.

list menu=;             // The main menu when first clicking on hud/object
list Save=;   // Save options
list Go_Too=;     // Teleport options    
list Fast_Go=;      // This enabled or disable the main_menu so you can Teleport faster     

Pos_01()
{//The First Position to save on.
    position_01 = llGetPos(); // Get your position there and then

    llOwnerSay("Saving Position 1: "+(string)position_01); // Resays your position
}

 

Pos_02()
{//The Second Position to save on.
   position_02 = llGetPos(); // Get your position there and then

    llOwnerSay("Saving Position 2: "+(string)position_02);// Resays your position 

}//You can add more by copy/paste. Or ask for help Smiley Happy

GO_POS01()
{//User function
    do //Do-while loop.
    {
        llPushObject((llGetOwner()),(position_01-llGetPos())*(llVecDist(llGetPos(),position_01)),ZERO_VECTOR,FALSE); //Pushes the avatar to the position.

        llMoveToTarget(position_01,0.05); //If your agent gets close to the avatar it will direct the path.
    }
    while(llVecDist(position_01,llGetPos()) > 40.0); //End of do-while loop
    llMoveToTarget(position_01,0.05); //Movement
    llSleep(0.5); //Prevents you from flying.
    llStopMoveToTarget(); //Stops the movement

} 
 

GO_POS02()
{//User function
    do //Do-while loop.
    {
        llPushObject((llGetOwner()),(position_02-llGetPos())*(llVecDist(llGetPos(),position_02)),ZERO_VECTOR,FALSE); //Pushes the avatar to the position.

        llMoveToTarget(position_02,0.05); //If your agent gets close to the avatar it will direct the path.
    }

    while(llVecDist(position_02,llGetPos()) > 40.0); //End of do-while loop

    llMoveToTarget(position_02,0.05); //Movement

    llSleep(0.5); //Prevents you from flying.

    llStopMoveToTarget(); //Stops the movement

}

default
{
    state_entry()
    {
        llListen(menuChannel,"",llGetOwner(),""); // To change number this listen too change it up top!
    }
    listen(integer channel,string name,key id,string message)
    {
    if(message == "back")
    {//Takes you back to main menu after going into a second option menu
        llDialog(id,"Main Menu",menu,menuChannel);
    }
    if(message == "Save")
    {
        llDialog(id,"Save Menu",Save,menuChannel); // Opens second Dialog box
    }
    if(message == "FastGo")
    {
        llDialog(id,"Fast Go",Fast_Go,menuChannel); // Opens the Fast Go Options
    }
    if(message == "enable")
    {
        llOwnerSay("Hot Key enabled. Note that save option disabled");
        FASTGO = FALSE;
    }
    if(message == "disable")
    {
        llOwnerSay("Hot Key disabled. Note that save option enabled");

        FASTGO = TRUE;
    }
    if(message == "Go To")
    {
       llDialog(id,"Go Too Menu",Go_Too,menuChannel); // Opens second Dialog box
    }
    if(message == "Save 1")
    {
        Pos_01();//Sends info to function up top
    }
    if(message == "Save 2")
    {
        Pos_02();//Sends info to function up top
    }
    if(message == "Go 1")
    {
        llOwnerSay("Slapping to this point: "+(string)position_01+".");// Says when begin teleported and where

        GO_POS01();//Sends info to function up top
    }
    if(message == "Go 2")
    {
        llOwnerSay("Slapping to this point: "+(string)position_02+".");// Says when begin teleported and where

        GO_POS02();//Sends info to function up top
    }
}
    touch_start(integer total_number)
    {
        if(FASTGO)
        {
            llDialog(llDetectedKey(0),"Main Menu",menu,menuChannel); //When touched ui box will pop up
        }
        else
        {
            llDialog(llDetectedKey(0),"Main Menu",Go_Too,menuChannel); //This loads up if the Fast Option is enabled

        }
    }
}
/*

    Sims Self Teleport v1.1
    With dialog menu
    Created by: Mulligan Silversmith
    Finished on: Jan 2011
    All Rights Reserved
    

    This script is free software: you can redistribute it and/or modift it under the terms that you share         this script with other people.

    -You are allowed to use this script in your products however the script may not be sold stand alone under     any circumstance.

    -If you give this script to other people please give the original script with this license.

 

 

*/