Position change
From Second Life Wiki
Second Life Wiki > Position change
| LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Tutorials |
| | LSL Feature Request |
| The described event does not exist. This article is a feature request. |
Contents |
Description
Event: position_change( ){ ; }| REQUEST | Event ID |
An event for avatar transitions from sitting to standing, standing to flying, etc. Such events can be monitored with a timer event; however, that's murder on a server. Must call llTrackAvatarPositionChange with permission PERMISSION_TRACK_POSITION.
Caveats
- If PERMISSION_TRACK_POSITION is not set when llTrackAvatarPositionChange is not set then "Permissions do not allow to track avatars position change." is shouted on DEBUG_CHANNEL.
Notes
And this is different then using (not_)at_target how? --Strife Onizuka 18:58, 20 April 2007 (PDT)
"It registers a position with a range that triggers at_target and not_at_target events continuously until unregistered." - we're trying to avoid continuous events as they aren't very nice to the poor sim executing them --Synack Fitzgerald 12:25, 14 May 2007 (EDT)
- I guess I should have just spelled things out. You can emulate this with minimal hassle and load on the sim. The benefits do not out weight costs of developing and debugging. The benefits are marginal and it doesn't add anything to LSL that can't already be done; there is no valid reason to add this. See below. -- Strife Onizuka 04:05, 14 May 2007 (PDT)
integer target;
default
{
touch_start(integer a)
{
if(target)
{
llTargetRemove(target);
target = 0;
}
else
target = llTarget( llGetPos(), 0.001 );
}
not_at_target()
{
llTargetRemove(target);
target = llTarget( llGetPos(), 0.001 );
}
}
//This version tells you the change. It will have problems on sim boundaries (tracking that requires extra work).
integer target;
vector pos;
default
{
touch_start(integer a)
{
if(target)
{
llTargetRemove(target);
target = 0;
}
else
target = llTarget( pos = llGetPos(), 0.001 );
}
not_at_target()
{
llTargetRemove(target);
vector new_pos = llGetPos();
target = llTarget( new_pos, 0.001 );
llSay(0,"change = "(string)(new_pos - pos));
pos = new_pos;
}
}

