RegionSitTeleport

Expired

It's a very simple and clean script to make quick sit/unsit teleport to given position based on reading current prim's description.

 

////////////////////////////////////////////////////////
//             Written by Vincent Nacon
//          Released into the Public Domain
//   I'm sick and tired of WarpPos and <0,0,0> bug.
//                    Feb 26th 2012
////////////////////////////////////////////////////////
 
//What to do?
//Just place position (in vector form) where you want to drop avatar at in the prim's description.
 
default
{
    changed(integer change)
    {
        vector targetPosition = (vector)llGetObjectDesc();
 
        key sittingAvatar = llAvatarOnSitTarget();
 
        if(sittingAvatar)
        {
            vector positionToReturnTo = llGetPos();
 
            llSetRegionPos(targetPosition);
            llUnSit(sittingAvatar);
            llSetRegionPos(positionToReturnTo);
        }
    }
 
    state_entry()
    {
        llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION);
    }
}

 

Zippadeedoodah (Teleporter)

Expired

These are those "sit & go" type prim based teleporters that you might use to get from the ground to a skybox (or similar). It uses a function that uses almost no memory compared with and as opposed to another popular function performing a similar task.

Add the destination as a comma separated string of three numbers to the description of the prim the script is in (ideally the root).
    https://d1yjxggot69855.cloudfront.net/skins/monobook/bullet.gif); ">
  • E.g. 36,128,4000.5
The numbers represent the X,Y and Z coordinates of the destination on the region the scripted object is on.

When you sit on the object the operation happens automatically.

 

  • Thanks to Strife Onizuka for helping improve this function (and my knowledge).
  • Temp Rez Version ( V7 )

This version is a one way, self deleting type. E.g. An object containing this script could be rezzed by a sign when touched allowing visitors to use the rezzed teleporter to be taken directly to areas of a region/parcel. Since the sign could be just 1 prim providing multiple destinations and each rezzed teleporter is both temporary and phantom the savings on both prim count and server stress

 are obvious.

// V7 //
 
Zippadeedoodah(vector dest) // Feed in the destination vector.
{
    integer l_num = (!!llGetLinkNumber()); // Establish the link number of the root.
    list params = [6, dest]; // Create the parameters for llSetPrimParamsFast.
    // Loop while the distance between the root and dest is greater than 0.001 meter.
    while(llVecDist(llGetRootPosition(), dest) > 0.001)
    llSetLinkPrimitiveParamsFast(l_num, params); // Each iteration attempt to move to dest.
}
 
default
{
    on_rez(integer param)
    {
        llSetClickAction(CLICK_ACTION_SIT); // Makes the prim "Click to sit".
        llSetLinkPrimitiveParamsFast(-1, [PRIM_TEMP_ON_REZ, TRUE,  // Make the object temporary.
                                          PRIM_PHANTOM, TRUE]);    // And phantom.
        // Makes the object less intensive for the region. Also makes a smoother llUnSit.
    }
    changed(integer change)
    {
        if(change & CHANGED_LINK) // If an avatar sits on the object they become one of the links.
        {
            integer links = 0; // Create an integer type variable
            if(llGetObjectPrimCount(llGetKey()) <(links = llGetNumberOfPrims())) // Check if there are more links than prims.
            {
                llSetLinkPrimitiveParamsFast(-1, [PRIM_TEMP_ON_REZ, TRUE]); // Make the object temporary.
                Zippadeedoodah(((vector)("<" + llGetObjectDesc() + ">"))); // Call the function to transport us.
                llUnSit(llGetLinkKey(links)); // When we arrive, Un-Sit the key that is not a prim.
                llDie(); // Delete the object.
            }
        }
    }
}

 

Permanent Version ( V9 )

 

This version drops the user off at the destination then either waits for the set time or goes straight back home to be reused.

 

// V9 //
 
float time = 3600.0; // The time in seconds to wait before returning to home position.
                     // If set to zero, the return home for the object will be immediate.
 
/////////////////////////////////////////////////////////////////////////////////////////
 
Zippadeedoodah(vector dest) // Feed in the destination vector.
{
    integer l_num = (!!llGetLinkNumber()); // Establish the link number of the root.
    list params = [6, dest]; // Create the parameters for llSetPrimParamsFast.
    // Loop while the distance between the root and dest is greater than 0.001 meter.
    while(llVecDist(llGetRootPosition(), dest) > 0.001)
    llSetLinkPrimitiveParamsFast(l_num, params); // Each iteration attempt to move to dest.
}
 
vector home; // Used to store the home position.
 
default
{
    state_entry()
    {
        home = llGetRootPosition(); // Establish where our home pos is.
        // For this reason, Reset the script when the home position of the object is chosen.
        llSetClickAction(CLICK_ACTION_SIT); // Makes the prim "Click to sit".
        llSetStatus(STATUS_PHANTOM, TRUE); // Makes the object less intensive for the region.
    }                                      // Also makes a smoother llUnSit.
    changed(integer change)
    {
        if(change & CHANGED_LINK) // If an avatar sits on the object they become one of the links.
        {
            integer links = 0; // Create an integer type variable
            if(llGetObjectPrimCount(llGetKey()) <(links = llGetNumberOfPrims())) // Check if there are more links than prims.
            {
                vector Dest; // Create a vector type variable.
                if(llVecDist(llGetRootPosition(), (Dest = ((vector)("<" + llGetObjectDesc() + ">")))) > 0.0015)
                { // Check if the object is near destination. If not, go there.
                    Zippadeedoodah(Dest); // Call the function to transport us.
                    llUnSit(llGetLinkKey(links)); // When we arrive, Un-Sit the key that is not a prim.
                    if(((integer)time))
                    llSetTimerEvent(time); // Start a timer.
                    else
                    Zippadeedoodah(home); // Go back home.
                }
                else
                llUnSit(llGetLinkKey(links)); // Un-Sit the key that is not a prim.
            }
        }
    }
    timer()
    {
        llSetTimerEvent(0.0); // Cancel the timer.
        Zippadeedoodah(home); // Go back home.
    }
}

 

Warp Cross Sim

Expired

//Warp Cross-Sim Teleportation
//Warp from warpPos script by Keknehv Psaltery
//Full Script by Khalek Trescothick
//This Script is classified as open-source
//Do not remove this header
vector pos;
vector my_pos;
vector g_target;
vector save;
string sim;
string dest_sim;
integer c = 92805;
integer NeedToCrossSim = FALSE;
integer near_check = FALSE;
integer target = FALSE;
llWarp2Pos( vector d )
{
        if ( d.z > 768 )
        d.z = 768;
        integer s = (integer)(llVecMag(d-llGetPos())/10)+1;
        if ( s > 100 )
        s = 100;
        integer e = (integer)( llLog( s ) / llLog( 2 ) );
        list rules = [ PRIM_POSITION, d ];
        integer i;
        for ( i = 0 ; i  0 )
        rules += llList2List( rules, 0, r * 2 + 1 );
        llSetPrimitiveParams( rules );
}
default
{
        on_rez(integer rez)
        {
                llResetScript();
        }
        state_entry()
        {
                llListen(92805, "", "", "");
                llSitTarget(<0,0,0>,ZERO_ROTATION);
        }
        dataserver(key TID, string data)
        {
                g_target += (vector)data;
                vector G2 = g_target;
                G2.z = 200;
                save = llVecNorm(G2 - llGetRegionCorner());
                if(llRound(save.y*2)>0)
                save = <127 ,255,200>;
                else if(llRound(save.y*2)<0)
                save = <128,0,200>;
                else if(llRound(save.x*2)>0)
                save = <255 ,128,200>;
                else if(llRound(save.x*2)<0)
                save = <0,128,200>;
                if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))
                {
                        save = llVecNorm(g_target - llGetRegionCorner());
                        if(llRound(save.x*2)>0)
                        save = <255 ,128,200>;
                        else if(llRound(save.x*2)<0)
                        save = <0,128,200>;
                        else if(llRound(save.y*2)>0)
                        save = <128 ,255,200>;
                        else if(llRound(save.y*2)<0)
                        save = <128,1,200>;
                        if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))
                        {
                                llWhisper(0,"Pinpoint Error");
                                llUnSit(llAvatarOnSitTarget());
                                llSleep(1.0);
                                llDie();
                        }
                }
                NeedToCrossSim=TRUE;
                llWarp2Pos(save);
                llMessageLinked(-1,0,"done","");
        }
        link_message(integer prim,integer chan,string m, key id)
        {
                if(m == "done")
                {
                        if(NeedToCrossSim)
                        {
                                vector P = llGetPos();
                                if(P.x==0)
                                P.x = -3;
                                else if(P.x==255)
                                P.x = 258;
                                if(P.y==0)
                                P.y = -3;
                                else if(P.y==255)
                                P.y = 258;
                                llSleep(3.5);//Needed delay so you do not crash over sim borders!
                                llSetPos(P);
                                NeedToCrossSim = FALSE;
                                llSleep(4);
                        }
                        sim = llGetRegionName();
                        if(sim != dest_sim)
                        {
                                g_target.z = 200;
                                save = llVecNorm(g_target - llGetRegionCorner());
                                if(llRound(save.y*2)>0)
                                save = <128 ,255,200>;
                                else if(llRound(save.y*2)<0)
                                save = <128,0,200>;
                                else if(llRound(save.x*2)>0)
                                save = <255 ,128,200>;
                                else if(llRound(save.x*2)<0)
                                save = <0,128,200>;
                                if(llEdgeOfWorld(llGetPos(), llVecNorm(save - llGetPos())))
                                {
                                        save = llVecNorm(g_target - llGetRegionCorner());
                                        if(llRound(save.x*2)>0)
                                        save = <255 ,128,200>;
                                        else if(llRound(save.x*2)<0)
                                        save = <0,128,200>;
                                        else if(llRound(save.y*2)>0)
                                        save = <128 ,255,200>;
                                        else if(llRound(save.y*2)<0)
                                        save = <128,0,200>;
                                }
                                NeedToCrossSim = TRUE;
                                llWarp2Pos(save);
                                llMessageLinked(-1,0,"done","");
                        }
                        else if(sim == dest_sim)
                        {
                                NeedToCrossSim = FALSE;
                                llWarp2Pos(my_pos);
                                llSay(0,"Luccyy im hoomee");
                                llUnSit(llAvatarOnSitTarget());
                                llDie();
                        }
                }
                else
                {
                        pos = g_target - llGetRegionCorner();
                }
        }
        changed(integer change)
        {
                if(change & CHANGED_REGION)
                {
                        llMessageLinked(LINK_SET, 0, "done", "");
                }
        }
        listen(integer channel,string name,key id,string message)
        {
                if(message == message)
                {
                        list d = llParseString2List(message,["*"],[]);
                        list p = llCSV2List(llList2String(d,0));
                        float x = llList2Float(p,0);
                        float y = llList2Float(p,1);
                        float z = llList2Float(p,2);
                        pos = ;
                        my_pos = ;
                        llMessageLinked(LINK_SET, 0, "bu", NULL_KEY);
                        dest_sim = llList2String(d,1);
                        if(llGetSubString(dest_sim,0,0) == " ")
                        {
                                dest_sim = llGetSubString(dest_sim,1,-1);
                        }
                        if(llGetRegionName() == dest_sim)
                        {
                                llWarp2Pos(my_pos);
                        }
                        else
                        {
                                llRequestSimulatorData(dest_sim, DATA_SIM_POS);
                        }
                }
        }
}

 

Long Distance Teleporting

Expired

// Long distance teleport version 1.1
// ----------------------------------
// This script is based on other public domain free scripts, so I don't
// take credit for any of the work here.
// Bits and pieces combined by Lisbeth Cohen - plus added show/hide.
//
// The basics of the script is based on Till Sterling's simple teleport
// script, with cross sim transportation routine developed by
// Keknehv Psaltery, modified by Strife Onizuka, Talarus Luan and
// Keknehv Psaltery.
// The transportation functionality is based upon Nepenthes Ixchel's
// 1000m Menu-driven Intra-Sim Teleporter
//
// Thank you to authors who have given me permission to publish this script.
// A special thank you to Keknehv Psaltery for suggesting small improvements!
//
// Realeased as public domain - you are NOT allowed to sell it without the
// permissions of all the authors I've credited above (except those who
// may have left sl at the time)!
// Feel free to use it in freebies and to give it to your friends :-)
//
// Please do not take credit for the work of all those great authors
// mentioned above!
// If you edit the script, please do not change the lines above - thanks!
// ------------------------------------------------------------------------
 
//The target location .. change this to where you want to end up (x, y, z)
vector gTargetPos = <246 , 181, 415>;
// Text for the "pie menu"
string gSitText="Teleport";
// Define channel number to listen to user commands from
integer myChannel = 123;
 
// No need to edit the global variables below
 
// Return position for tp object - no need to edit
vector gStartPos=<0,0,0>;
// Key for avatar sitting on object, if any
key gAvatarID=NULL_KEY;
// If you don't enable this the teleport object will be left at the destination.
integer gReturnToStartPos=TRUE;
 
// This routine do the actual transport
warpPos( vector destpos)
{   //R&D by Keknehv Psaltery, 05/25/2006
        //with a little pokeing by Strife, and a bit more
        //some more munging by Talarus Luan
        //Final cleanup by Keknehv Psaltery
        // Compute the number of jumps necessary
        integer jumps = (integer)(llVecDist(destpos, llGetPos()) / 10.0) + 1;
        // Try and avoid stack/heap collisions
        if (jumps > 100 )
        jumps = 100;    //  1km should be plenty
        list rules = [ PRIM_POSITION, destpos ];  //The start for the rules list
        integer count = 1;
        while ( ( count = count << 1 ) < jumps)
        rules = (rules=[]) + rules + rules;   //should tighten memory use.
        llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );
}
 
default
{
        state_entry()
        {
                // Put the teleport text in place of the Sit in the pie menu
                llSetSitText(gSitText);
                // Read the objects position so it can return to it after teleporting
                gStartPos = llGetPos();
                // Sit the avatar on the object
                llSitTarget(<0,0,1>,ZERO_ROTATION);
                // Define commands to listen for
                llListen(myChannel,"","","");
        }
 
        on_rez(integer startup_param)
        {
                llResetScript();
        }
 
        listen(integer chan, string name, key id, string cmd)
        {
                if (cmd == "show")
                {
                        llSetAlpha( 1, ALL_SIDES );
                }
                else if (cmd == "hide")
                {
                        llSetAlpha( 0, ALL_SIDES );
                }
                else if (cmd == "reset")
                {
                        llResetScript();
                }
                else if (cmd == "help")
                {
                        llSay(0, "Usage:");
                        llSay(0, "");
                        llSay(0, "show      Make teleporter visible");
                        llSay(0, "hide      Make teleporter invisible");
                        llSay(0, "reset     Resets teleporter script");
                        llSay(0, "help      This text");
                }
        }
 
        changed(integer change){
                if(change & CHANGED_LINK)
                {
                        // Find id for avatar sitting on the object
                        gAvatarID = llAvatarOnSitTarget();
                        // If someone sits on it...
                        if(gAvatarID != NULL_KEY)
                        {
                                // Move avatar to destination
                                warpPos(gTargetPos);
                                // Pause for 1 second
                                llSleep(1);
                                // Unsit avatar
                                llUnSit(gAvatarID);
                                // Wait 1 second more
                                llSleep(1);
                                // If teleporter should return to original position....
                                if (gReturnToStartPos)
                                {
                                        // ... send object to its start position
                                        warpPos(gStartPos);
                                }
                        }
                }
        }
 
}