Template:Needs Translation/
函数名
|
Function: llUnSit( key id );
|
参数:如果出现以下任何情况,则id标识的代理将被迫站起来:
代理坐在脚本对象上
代理位于脚本对象的所有者和/或所有者拥有土地权利的组所拥有的土地上。
•密钥id–位于同一区域的虚拟UUID
|
返回值:无
|
示例
|
示例1
// UnSit on Sit, Using a sit target
default
{
state_entry()
{
llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); // Needed for llAvatarOnSitTarget to work. The vectors components must not all be set to 0.0
}
changed(integer change) // Triggered when various changes are sensed.
{
if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
{
key user = llAvatarOnSitTarget(); // Store the UUID of any agent sitting on the sit target.
if(user) // An avatar is on the sit target.
llUnSit(user); // Un-Sit the avatar.
}
}
}
// UnSit on Sit, NOT using a sit target
default
{
changed(integer change) // Triggered when various changes are sensed.
{
if(change & CHANGED_LINK) // When an agent sits on an object they become a new link.
{
integer links = 0; // Create an integer type variable.
if(llGetObjectPrimCount(llGetKey()) < (links = llGetNumberOfPrims())) // During the check store the number of links.
// If the number of prims is fewer than the number of links, the last must be an avatar.
llUnSit(llGetLinkKey(links)); // Use the key of the last link to be added (the avatar) to call llUnSit().
else
llOwnerSay("Some kind of linking or unlinking has changed me but, I am not being sat on.");
// llUnSit() triggers the changed event too (the number of links is reduced by 1).
}
}
}
unsit_all_avatars()
{
integer objectPrimCount = llGetObjectPrimCount(llGetKey());
integer currentLinkNumber = llGetNumberOfPrims();
for (; objectPrimCount < currentLinkNumber; --currentLinkNumber)
llUnSit(llGetLinkKey(currentLinkNumber));
}
default
{
touch_start(integer num_detected)
{
unsit_all_avatars();
}
}
|