Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Teleport script help

Kitty Beery
Registered User
Join date: 4 Feb 2007
Posts: 14
02-15-2007 23:39
Hello everybody,

i'm new on scripting and tried something out.
I understand most of the help files but not all. My english isn't too bad, but it isn't my first language.

I got a simple teleport script to use in my house to get from one floor to the other. Put up a prim on both floors and put the script in it. No problem so far.

Then editted the script to the correct vectors. It isn't a relative script, can't get those to work right yet. I'm sure that's my fault but they don't work for me at the moment i tried.

Editted the script on the first floor to tp to the second floor. That one works, i land exactly on the vectors i put in the script.
After that editted the script on the second floor with the vectors of the first floor. Can't get that one to work the way it should. I tried different vectors but most of the time i land outside of the house. Most of the time behind the wall the prim is on, sometimes high up in the sky.
In the end i found vectors that get me in the room below, but not on the vectors i put in.

The only relative script i found (it should be relative) has the same problem, i only change the altitude vector and still end up a long distance outside the house on the ground floor.

Anybody know what the problem is in this case?
Or anybody has a working (relative) script for me to get from one floor to the other? And if so, with a little bit of help how to change the vectors?

Thanks, Kitty.
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
02-16-2007 00:52
Kitty, would help if you posted the script you are using.

A basic teleport is usually based around using a prim's sit target.

llSitTarget is actually a relative position hence the code will usually look something like

CODE

llSitTarget(dest-llGetPos(), <0,0,0,1>);


where dest is the sim coordinate of where you want to go. To use relative coordinates use something like

CODE

rotation rot = llGetRot();
llSitTarget( dest / rot, ZERO_ROTATION / rot );


Dividing by rotation will mean that you will end up at the same relative point even when the TP prim is rotated, ideal for use in houses.

Something that often throws people off, literally, is AV velocity. When you sit on a tp froma distance your AV is moved by SL to sit on the TP. This applies a velocity, often quite large, to the AV. When you unsit this then throws you off. The workaround is to put a llSleep call in prior to the llUnSit call.

CODE

llSleep(0.5);
llUnSit(av);