Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Need help with a teleport script

bingbangboom Bixby
Registered User
Join date: 17 Aug 2004
Posts: 92
05-11-2005 13:42
I have this one

key lastAVkey = NULL_KEY;
string fltText = "Down to Livingroom";
vector dest = <45.355,118.701,48.518>;
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();
}
}
}

And i thought where it says Vect Dest is where i put the numbers. So I place an item where i want it to be. Then take the numbers, but it doesn't really work that way. Sometimes I either get thrown to some other place or float around somewhere kinda close to it but in the sky. Can someone please help me?
Lecktor Hannibal
YOUR MOM
Join date: 1 Jul 2004
Posts: 6,734
05-11-2005 13:44
vector dest = <45.355,118.701,48.518>;

I think you need some space bars:

vector dest = <45.355, 118.701, 48.518>;
_____________________
YOUR MOM says, 'Come visit us at SC MKII http://secondcitizen.net '

From: Khamon Fate
Oh, Lecktor, you're terrible.

Bikers have more fun than people !
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
05-11-2005 13:48
The script looks fine, and though spaces help with readability, it shouldn't effect the script...

Here's what I suspect: Check your object. Make sure it's rotation is 0 on all axes. If it's not, then you end up rotating the relative destination, and you end up in strange places. This is a common problem if you rez a sphere, since it comes prerotated 90 degrees on the Y axis.
_____________________
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
05-11-2005 13:54
Here's a script that I've used successfully.

Two points.

1) It has some rotation stuff that's supposed to nullify the rotation of the prim. That's the problem that Jillian mentioned.
2) llSleep() before the unsit can help keep the AV from jumping around at the destination.

CODE

// Based on a script by Hank Ramos
//
// Some modifications by Shack Dougall

vector targetPos = <125, 163, 88>; //The target location

reset()
{
vector target;

target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(target, ZERO_ROTATION);
llSetSitText("Teleport");
}
default
{
state_entry()
{
reset();
}

on_rez(integer startup_param)
{
reset();
}

changed(integer change)
{
llSleep(0.15);
llUnSit(llAvatarOnSitTarget());
reset();
}
}
_____________________
Prim Composer for 3dsMax
-- complete offline builder for prims and sculpties in 3ds Max
http://liferain.com/downloads/primcomposer/

Hierarchical Prim Archive (HPA)
-- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools.
https://liferain.com/projects/hpa
Lecktor Hannibal
YOUR MOM
Join date: 1 Jul 2004
Posts: 6,734
05-11-2005 13:57
From: Jillian Callahan
The script looks fine, and though spaces help with readability, it shouldn't effect the script...

Here's what I suspect: Check your object. Make sure it's rotation is 0 on all axes. If it's not, then you end up rotating the relative destination, and you end up in strange places. This is a common problem if you rez a sphere, since it comes prerotated 90 degrees on the Y axis.

Ahh yes I'd forgotten about that, I had learned that the hard way some time ago.
Nice script Shack.
_____________________
YOUR MOM says, 'Come visit us at SC MKII http://secondcitizen.net '

From: Khamon Fate
Oh, Lecktor, you're terrible.

Bikers have more fun than people !
bingbangboom Bixby
Registered User
Join date: 17 Aug 2004
Posts: 92
05-11-2005 14:05
It goes X, Y, Z right... and what if the distance is too far? does that even matter?
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
05-11-2005 14:15
300 meter limit. This isn't usually a problem. :)
_____________________
bingbangboom Bixby
Registered User
Join date: 17 Aug 2004
Posts: 92
05-11-2005 14:58
Thanks alot that second script seemed to do the job perfect. Thanks :D
Kenn Nilsson
AeonVox
Join date: 24 May 2005
Posts: 897
07-03-2005 09:48
Hmmm...I seem to be having the same problem the original poster had--but nothing is solved when I ensure that the object at my destination is 0 rotation.

It seems as if the teleportation is almost random...just a luck of the draw selection of numbers that have no correspondance with actual vector locations...

Some more advice either here or in game would be greatly appreciated.

---UPDATE: Fixed the problem...no replies needed. Sorry for bother.
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
07-03-2005 09:54
Remember that the destination is relative to the prim, not the sim.
And the prim that needs to be unrotated is the source, not the destination.

Hank's script that Shack posted above takes care of both of those for you. It's a fab script, give it a shot!
_____________________
Burke Prefect
Cafe Owner, Superhero
Join date: 29 Oct 2004
Posts: 2,785
07-03-2005 14:17
Um, how far away is the teleporter from the destination?
Nber Medici
Registered User
Join date: 18 Feb 2004
Posts: 108
unreliable results with this script
07-13-2005 09:48
Gee, this script sounded so great. I used it and it worked at first and then had very unreliable results - sending me off in the boondocks. Does anyone know what the problem might have been?

Thanks!
Synergy Belvedere
Prim Reaper
Join date: 7 Jul 2004
Posts: 253
07-13-2005 11:59
If your rotations are still zero, i find that recompiling the script generally does the trick in these cases.
_____________________
----------------------------------------------------------
--The mind's eye is limited only by its focus--