Jump to content
  • 0

Teleport object goes up too!


You are about to reply to a thread that has been inactive for 325 days.

Please take a moment to consider if this thread is worth bumping.

Question

I built a skybox in the mainland.  I was trying to write a script to go up to it with limited success.  I then found a script in the marketplace to do this and bought it.  ( no response from the creator but it was very cheep)  The script works well but the object that i inserted the script into 'follows me up into the sky ' it is always a bit below me ( can get exact coordinates if needed) can anyone tell me why this is happening or what I should do?

 

Here is a copy of the script

//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/ The script begins _/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
vector destination = <175,88,1001>; // the destination coordinate
string text = "Touch To Teleport"; // optional floating text on the teleporter, input a space if not used
vector text_color = <1.0,1.0,1.0>; // the floating text's color
integer touch2sit = TRUE; // TRUE - left click to sit; FALSE - left click to touch
integer access_mode = 1; // 1 - public; 2 - owner; 3 - group;

//=================================================
posJump( vector target_position )
{// Trickery discovered by Uchi Desmoulins and Gonta Maltz. More exact value provided by Fake Fitzgerald.
    llSetPrimitiveParams([PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION, target_position ]);
}
//=================================================
warpPos( vector destpos ) 
{   //R&D by Keknehv Psaltery, 05/25/2006; unlimited modified by Klug Kuhn 10/01/2008

    // Change this safety range depends on your script memory
    // The larger the range, the quicker (and less "flashes") to get to the destination, however, the more to eat up script memory.
    float safety_range = 1000.0;


    integer arrived = FALSE;
    integer within_range = FALSE;
    vector inter_pos = ZERO_VECTOR;
    vector current_pos = llGetPos();
    vector checking_pos = destpos;
    integer jumps = 0;
    list rules = [];
    integer count = 0;

    if (llVecDist(destpos, current_pos) <= safety_range)
    {
        jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1;
        rules = [ PRIM_POSITION, destpos ];  //The start for the rules list
        count = 1;
        while ( ( count = count << 1 ) < jumps)
            rules = (rules=[]) + rules + rules;   //should tighten memory use.
        llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );            
    }
    else
    {
        while (!arrived)
        {
            current_pos = llGetPos();
            checking_pos = destpos;
            
            within_range = FALSE;              
            while (!within_range)
            {
                if (llVecDist(checking_pos,current_pos) > safety_range)
                {
                    checking_pos = <(current_pos.x + checking_pos.x) / 2.0,(current_pos.y + checking_pos.y) / 2.0,(current_pos.z + checking_pos.z) / 2.0>;
                }
                else
                {
                    within_range = TRUE;
                    
                    if (llVecDist(destpos, current_pos) <= safety_range)
                    {
                        jumps = (integer)(llVecDist(destpos, current_pos) / 10.0) + 1;
                        rules = [ PRIM_POSITION, destpos ];  //The start for the rules list
                        count = 1;
                        while ( ( count = count << 1 ) < jumps)
                            rules = (rules=[]) + rules + rules;   //should tighten memory use.
                        llSetPrimitiveParams( rules + llList2List( rules, (count - jumps) << 1, count) );            
                        
                        arrived = TRUE;
                    }                    
                }
            }
            
            if (!arrived)
            {
                jumps = (integer)(llVecDist(checking_pos, current_pos) / 10.0) + 1;
                rules = [ PRIM_POSITION, checking_pos ];  //The start for the rules list
                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()
    {
        llSitTarget(<0.0, 0.0, 0.01>, ZERO_ROTATION);                        
        llSetText(text,text_color,1.0);
        if (touch2sit)
            llSetClickAction(CLICK_ACTION_SIT);
        else
            llSetClickAction(CLICK_ACTION_NONE);
    }  
    changed(integer change)
    {
        if (change & CHANGED_LINK)
        {
            key user = llAvatarOnSitTarget();
            if (llGetAgentSize(user) != ZERO_VECTOR)
            {
                integer access_granted = FALSE;
                if (access_mode == 1)
                    access_granted = TRUE;
                else if (access_mode == 2) 
                {
                    if (user == llGetOwner())
                        access_granted = TRUE;
                    else
                    {
                        llUnSit(user);                        
                        llSay(0,"  sorry, owner access only.");
                    }
                }
                else if (access_mode == 3) 
                {
                    if (llSameGroup(user))
                        access_granted = TRUE;
                    else
                    {
                        llUnSit(user);
                        llSay(0,"  sorry, group memeber access only.");
                    }
                }
                
                if (access_granted)
                {
                    vector init_pos = llGetPos();                
//                  warpPos(destination); // use warPos() function
                    posJump(destination); // use posJump() function
                    llUnSit(user);
                    llSleep(0.2);
//                  warpPos(init_pos); // use warPos() function
                    posJump(init_pos); // use posJump() function                
                }
            }
        }
    }    
}
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/ The script ends _/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
//_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 2

That is an extremely old script, using a function (WarpPos) that hasn't been necessary in SL for at least the past ten years. This one for some reason also uses the antiquated JumpPos  function, which does exactly the same thing. I'd advise you to simply toss it and write your own sit transporter instead.  Use the llSetRegionPos function.  It was introduced ages ago as a quick, easy way to move an object to any spot in the region, immediately making the old, clumsy WarpPos and JumpPos functions unnecessary.

A sit transporter doesn't teleport you.   It's simply a prim that you sit on and then move to a different spot in the same region, while you are still sitting on it.  When you arrive, the script unseats you (that's the llUnSit function in your script) and then returns to the place where you found it ( that's why WarpPos and JumpPos in your script both point right back to init_pos at the end of the changed event ).

  • Like 3
Link to post
Share on other sites
  • 0

Here's a bit of history that might make it clearer why we ever had to use WarpPos.  In the early days of SL, the only way to move an object from one place to another was with llSetPos.  That's a fine, basic function but it has one major limitation:  it will move the object no more than 10 meters -- great for little local stuff but not for lifting an object a couple of thousand meters in the air.  Sometime very soon after SL opened, therefore, scripters began tinkering with ways to simulate long jumps by stringing together a set of 10 meter hops.  That's what both WarpPos and JumpPos do.  They were terrific for their time, but they had a couple of big limitations.  They moved the object in a straight line from point A to point B, but had no way of knowing whether the path would lead across places where scripts were disabled or there were ban lines or physical objects in the way.   Sit teleporters that used the functions would often stall and leave you stranded halfway.  The other big limitation was that llSetPos imposes a 0.2 second delay for each 10 m hop.  If you were hoping to jump from the ground to 3500 m, it was a slow elevator ride.  Scripters lobbied LL for a long time for a new function that would beat those two problems, and LL finally did, by giving us llSetRegionPos.  It moves an object in one single hop with no delay at all.  Scripters walked away from the old, obsolete functions overnight and never looked back.

Edited by Rolig Loon
  • Like 1
Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 325 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...