I'm trying to make the following script only work when a user in a Certain Group can teleport to the specified x,y,z coordinate.
Source: www.heatonresearch.com
// Scripting Recipes for Second Life
// by Jeff Heaton (Encog Dod in SL)
// ISBN: 160439000X
// Copyright 2007 by Heaton Research, Inc.
//
// This script may be freely copied and modified so long as this header
// remains unmodified.
//
// For more information about this book visit the following web site:
//
// http://www.heatonresearch.com/articles/series/22/
vector target=<190, 197, 64>;
vector offset;
default
{
moving_end()
{
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSitTarget(offset, ZERO_ROTATION);
}
state_entry()
{
llSetText("Teleport pad",<0,0,0>,1.0);
offset = (target- llGetPos()) * (ZERO_ROTATION / llGetRot());
llSetSitText("Teleport");
llSitTarget(offset, ZERO_ROTATION);
}
changed(integer change)
{
if (change & CHANGED_LINK)
{
llSleep(0.5);
if (llAvatarOnSitTarget() != NULL_KEY)
{
llUnSit(llAvatarOnSitTarget());
}
}
}
touch_start(integer i)
{
llSay(0, "Please right-click and select Teleport");
}
}
The teleport script uses two global variables. They are.
vector target=<190, 197, 64>;
vector offset; The target is the coordinate that the teleport script should send the user to. The offset is calculated based on the target and the current position of the teleporter. The offset is the distance that must be traveled to reach the target, starting from the teleporter.
Whenever the teleport pad is moved, the offset must be recalculated. The sit target is then updated.
moving_end()
{
offset = (target- llGetPos()) *
(ZERO_ROTATION / llGetRot());
llSitTarget(offset, ZERO_ROTATION);
} Likewise, when the teleport pad is first created, the offset must be recalculated. Additionally, the sit text is specified. Rotation is also taken into account and neutralized.
state_entry()
{
llSetText("Teleport pad",<0,0,0>,1.0);
offset = (target- llGetPos()) *
(ZERO_ROTATION / llGetRot());
llSetSitText("Teleport");
llSitTarget(offset, ZERO_ROTATION);
} When a user sits on the teleport pad, their avatar sits at the target location. The avatar is then stood up.
changed(integer change)
{
if (change & CHANGED_LINK)
{
llSleep(0.5);
if (llAvatarOnSitTarget() != NULL_KEY)
{
llUnSit(llAvatarOnSitTarget());
}
}
}
Ideas?