Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Teleport Script..

Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
07-19-2008 17:55
Picked up a freebie somewheres and am trying to get it to work. The positions are fine, but for some reason it only works ONCE.. Then causes the avatar to fly and move about, etc etc, on further use. Nothing's where the avatar is supposed to go. Anyone know?

--
key lastAVkey = NULL_KEY;
string fltText = "Teleportation Script";
vector dest = <83.409,118.854,259.091>;
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();
}
}
}

--

key lastAVkey = NULL_KEY;
string fltText = "Teleportation Script";
vector dest = <82,117,251>;
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();
}
}
}

--

I'm script-challenged apparently as even the simplist, ready-to-use script still finds a way to nag and ebb at my patience..
Scott Tureaud
market base?
Join date: 7 Jun 2007
Posts: 224
07-19-2008 18:23
Don't worry i'm going WTF as well. he's really just wasting a lot of script time there. Here's the freebie I made myself.

default
{
state_entry()
{
//script is limited to about 250 meter distance.

//used for setting text of sitting
llSetSitText("teleport";);

//use for setting location from the prim. in meters<distance X, distance Y, distance Z>. so <0, 0, 63> is 63 meters up. To be honest I just mess with it till I get what I want. and it's perspective is from the prim you sit on instead of a target location.
llSitTarget(<0,0, 63>, ZERO_ROTATION);



}
changed(integer change)
{
//unsits when you sit. LSL is quite about this error so it's not worth validating
llUnSit(llGetLinkKey(llGetNumberOfPrims()));
}


}
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
07-19-2008 18:31
That looks much easier!

.. Except the fact that she's still flying around like a drunk bee.. It's only 10 meters up, really can't be that hard! =x Lemme try a bit longer..


Edited: Nope.. Worked fine first time, then each time thereafter she continues to fly around and smack into everything.. Will try tomorrow. Maybe it's another lovely weekend glitch.
Scott Tureaud
market base?
Join date: 7 Jun 2007
Posts: 224
07-19-2008 18:37
the flying around is from the unsit command. it's not the gentlest of things. depending on some stuff I haven't bothered to test you can end up getting tossed around or nicely landing. aim like half a meter above the floor is a good start most the time.

edit: basically aim for no collisions with objects and stuff like that.
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
07-20-2008 12:29
It's just weird that it always works fine the first time =( Will see what I'm able to come up with.. Got a bit more time now, lol.
Taeas Stirling
Registered User
Join date: 4 Sep 2004
Posts: 74
07-20-2008 15:03
one of the old fixes was to add a one second sleep just before the unsit. That kills any inertia picked up moving to the sit vector. Also play with the height of the sit vector, rezzing a little to high or to low, wiggs the server out and off you go.
good luck with it.
Malina Chuwen
Evotive
Join date: 25 Apr 2008
Posts: 502
07-21-2008 09:23
Ok, well.. For right now I've settled on buying a single version that I can resell, and another version of a freebie teleporter.. Both of which are working rather well =)

Perhaps another time I'll fuss with this again, as now I'm back to work and will lack the time to fix it. Thank you all much, though.