> I inserted a .15 second sleep before the unsit to stop from flying. Worked fine in my lagfree sim ... would it need to be longer in worse circumstances?
> I noticed I was getting two 'Changed' events every time a TP happens ... is there one for the unsit as well as the sit?
> A person in another thread said that no flying would occur if I just reduced the push on unsit. Can't find a way to do that ... any ideas? Not really very fond of the llSleep solution.
> The previous script reset the target position after every sit. Is there any reason to do this ... prim drift or something?
Pls. ignore debugging llSays, lol:
// Script from NCI free teleport disks
// Modified to decrease flying after teleport
// and read target position from object description
// For best results, make sure teleport destination is far enough away from
// other objects so avatar does not collide after tp (end up flying).
// Setting Z point to .25 meter above actual landing helps.
// Note: destination TP point must be set in object Description line, e.g.
// Description: 169,158,600.25
// There is little error checking; script will not TP av's to 0,0,0, which
// is the value you get if you simply type ascii text into the description instead
// of a vector.
// Max distance that sit target can be away is 300m along any one axis.
vector targetPos; //The target location
integer i;
reset()
{
vector target;
list destination;
i = 0;
destination = llParseString2List(llGetObjectDesc(),[","],[]);
targetPos.x = llList2Float(destination,0);
targetPos.y = llList2Float(destination,1);
targetPos.z = llList2Float(destination,2);
if (targetPos == ZERO_VECTOR) { // user probably typed in a text desc
targetPos = llGetPos();
llSay(0, "Bad destination in object description: format x,y,z"
;}
llSay(0,(string)targetPos);
target = (targetPos- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(target, ZERO_ROTATION);
llSetSitText(llGetObjectName());
} // endreset
default
{
state_entry()
{
reset();
}
on_rez(integer startup_param)
{
reset();
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
if (i == 0) { // we get two changed events for each TP
llSay(0,"sit change"
;i = 1;
llSleep(0.15); // delay to avoid flying on landing
llUnSit(llAvatarOnSitTarget());
}
else {
llSay(0,"ignore"
;i = 0;
}
} // end avatar sat
else //some other prim change event
{
reset(); // why not?
}
}
}