Jump to content

Question About Teleport Script


Perrie Juran
 Share

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

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

Recommended Posts

Maybe I am confused about how llSetRegionPos works but as I understand from the wiki, http://wiki.secondlife.com/wiki/LlSetRegionPos , one of the purposes was to overcome the 1000 meter limit of llWarpPos.  But that is still as high I am able to get with it.

Also, is there a way to set which way an Avatar faces on arrival at destination?  I tried llSetRot but it is not accomplishing what I want, the Avatar always facing a certain direction on arrival.

Lastly, while I am playing with a couple of scripts, this one is bugging the heck out of me.  I keep getting a syntax error on line 8 (string text) and I cant figure out what it is.

 

Thanks in advance for your help.

_____________________

 

// ———————–SCRIPT STARTS BELOW THIS LINE———————–

    // Edit the next few lines to set up your teleporter. Brief instructions for each line are shown.
    // This script uses the Linden Lab llSetRegionPos function introduced in January 2012.
    // last update: 02-27-2012

    vector destination = <000, 000, 000>; // Replace the 3 numbers on this line with your destination coordinates x,y,z.

    string text = “Touch to Teleport”; // Edit the floating text that appears above the teleporter here.  Just insert a space for no text.

    vector text_color = <1.0,1.0,1.0>; // Change the color of the floating text if desired.

    integer touch2sit = TRUE; // TRUE – left click to sit; FALSE – left click to touch

    integer access_mode = 1; // Change the number on this line to assign who can use the teleporter: 1 – public, 2 – owner, 3 – group

    // You shouldn’t need to change anything below this line

    //=================================================
    //=================================================
    default
    {
    state_entry()
    {
    llSitTarget(<0.0, 0.0, 0.01>, ZERO_ROTATION);
    llSetSitText(“Teleport”);
    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 member access only.”);
    }
    }

    if (access_granted)
    {
    vector init_pos = llGetPos();
    llSetRegionPos(destination); // use llSetRegionPos function
    llUnSit(user);
    llSetRegionPos(init_pos); // use llSetRegionPos function
    }
    }
    }
    }
    }

 

Link to comment
Share on other sites

Several fixes and abit better tabbed, compiles without error now

 

// Edit the next few lines to set up your teleporter. Brief instructions for each line are shown.// This script uses the Linden Lab llSetRegionPos function introduced in January 2012.// last update: 02-27-2012vector destination = <0.0, 0.0, 0.0>; // Replace the 3 numbers on this line with your destination coordinates x,y,z.string text = "Touch to Teleport"; // Edit the floating text that appears above the teleporter here.  Just insert a space for no text.vector text_color = <1.0,1.0,1.0>; // Change the color of the floating text if desired.integer touch2sit = TRUE; // TRUE – left click to sit; FALSE – left click to touchinteger access_mode = 1; // Change the number on this line to assign who can use the teleporter: 1 – public, 2 – owner, 3 – group// You shouldn’t need to change anything below this line//=================================================//=================================================default{    state_entry()    {        llSitTarget(<0.0, 0.0, 0.01>, ZERO_ROTATION);        llSetSitText("Teleport");        llSetText(text,text_color,1.0);        if (touch2sit)        {            llSetClickAction(CLICK_ACTION_SIT);        }         else         {            llSetClickAction(CLICK_ACTION_NONE);        }    }            changed(integer change)    {        integer access_granted = FALSE;                if (change & CHANGED_LINK)        {            key user = llAvatarOnSitTarget();                        if (llGetAgentSize(user) != ZERO_VECTOR)            {                if (access_mode == 1)                {                    access_granted = TRUE;                }                 else if (access_mode == 2 && user == llGetOwner())                {                    access_granted = TRUE;                }                 else                {                    llUnSit(user);                    llSay(0,"orry, owner access only.");                }            }            else if (access_mode == 3)            {                if (llSameGroup(user))                {                    access_granted = TRUE;                }                else                {                    llUnSit(user);                    llSay(0,"Sorry, group member access only.");                }            }                        if (access_granted)            {                vector init_pos = llGetPos();                                llSetRegionPos(destination); // use llSetRegionPos function                llUnSit(user);                llSetRegionPos(init_pos); // use llSetRegionPos function            }        }    }}

 

Link to comment
Share on other sites

I don't know why you can't go over 1000 metres.   Certainly llSetRegionPos will go further up than that.   As to setting your rotation, if you set a sit target, that determines which way the avatar is facing when you start, so you should be able to point the teleporter and avatar how you want on arrival.

Try something like this to demonstrate both points:

integer toggle;vector pos;rotation rot;key k;default{    state_entry()    {        llSitTarget(<0.0,0.0,0.5>,ZERO_ROTATION);    }    changed(integer change)    {        if(change & CHANGED_LINK){            k = llAvatarOnSitTarget();            if(k){                pos = llGetPos();                rot = llGetRot();            }            else{                llSetRegionPos(pos);                llSetRot(rot);            }        }    }    touch_start(integer total_number)    {        if(llDetectedKey(0)==k){            toggle =!toggle;            if(toggle){                llSetRegionPos(<pos.x,pos.y,4000.0>);                llSetRot(llEuler2Rot(<0.0,0.0,90.0>*DEG_TO_RAD));            }            else{                llSetRegionPos(pos);                llSetRot(rot);            }        }    }}

 

Link to comment
Share on other sites

I have teleporter using llSetRegionPos() that goes beyond 3000m without problems.
I don't know why it is causing you problems; I don't think it is:) must be something else.

If you can hold your breath a knew teleport agent function is on it's way
It will be able to set the landing rotation and it will require no prim move
As I understand it, it comes in two flavors, one region wide and one world wide:)

Link to comment
Share on other sites

Thank you Innula.

I'll play with that later In World.

I think the problem I was having with rotation with the other script I was trying is it lacked llSitTarget, so my rotation on arrival was random depending on which way I was facing when I stared.  Can't remember off the top of my head now.

 

Link to comment
Share on other sites

There is no 1000m limit for warppos.

In pre-mono-times with only 16K script memory the lack of memory limited warppos to 1000m. (I made a version that did multiple 1000m jumps - so there never was a limit for me)

A mono script has sufficient memory to move over 4000m with a single jump.

But since llSetRegionPos is available it's all obsolete.

Link to comment
Share on other sites

Thank you very much. This works like a charm.

I had tried a couple of scripts.  Why one of them wouldn't get me over 1000 meters I have no idea.

I am still puzzling out how to incorporate Innula's thing into it.  I probably should really take some scripting classes.

Sometimes friends make comments about something they'd like and I take on the challenge.  It's just something I like to do.

Link to comment
Share on other sites

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

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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...