Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Teleport goes to wrong location

Hoodoo Chrome
Registered User
Join date: 12 Jan 2009
Posts: 4
03-29-2009 21:42
OK, I'm tearing my hair out trying to get this script to work correctly.

This is the script:

---------------------------------------------------------------------------------------------------
key lastAVkey = NULL_KEY;
string fltText = "Leave Store";
vector dest = <203.000,247.000,58.000>;
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 choose '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();
}
}
}
-------------------------------------------------------------------------------------------------

Problem is that instead of the coordinates 203,248,58 I go to 224,239,58 EVERY TIME. that coordinate is on someone else's parcel. I just can't figure it out. I tried changing the coordinates (used 193,247,58) but that goes to 224,259,58.

This is driving me nuts! I use the same script in several other places and they all work fine. I even tried to re-create the object from scratch and add a new copy of the script.

Any help is greatly appreciated.
Ron Khondji
Entirely unlike.
Join date: 6 Jan 2007
Posts: 224
From the wiki.
03-29-2009 22:02
offset is limited to 300.0 meters on each axis. The x, y and z components must be in the range [-300.0, 300] (-300.0 <= value <= 300).
If they are outside the acceptable range they are rounded to the closest limit.

If you are trying to move more then 300 meters you need a 'warppos' script or something similar. I think.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
03-30-2009 05:02
dest-llGetPos()
if any axis in that is > 300 ti'll be limited to 300. add this line to check
llOwnerSay ( (string)(dest-llGetPos()) );

if that looks good, (and it probably does) then throw a sleep in front of your unsit. it's possible they're being unsat before they get all the way to the destination.

you might also what to move (and swap the order of) the stop animation and unsit to the permissions event. the reset can go there too.

FWIW you don't really have to stop the sit animation, since it'll stop on it's own when you unsit them, in which case you don't need permissions.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -