Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Discussion: Reliably detect when avatar moves

Geuis Dassin
Filming Path creator
Join date: 3 May 2006
Posts: 565
12-16-2006 15:28
Hey, I found that move_start() and move_end() just plain don't work.

I've created this little chunk of code that seems to *ALWAYS* tell me when the prim moves. If you have this in an attachment, it tells you when your avatar moves.

What it does is simple. On state_entry(), set the current position of the prim. The range is within 1 meter, though you of course can change this to your needs. (for example, if you only want to trigger when your avatar moves outside of a current area from where its at.)

As soon as you move outside of the defined range, then the not_at_target() event fires. You then reset the llTarget position as you did during state_entry().

This will effectively fire any time your avatar moves, in any direction, including flying.

CODE

state_entry(){
//define current avatar/prim position here
llTarget(llGetPos(), 1.0);
}

not_at_target(){
//Moved
llOwnerSay("Moved");
llTarget(llGetPos(), 1.0);
}
Nada Epoch
The Librarian
Join date: 4 Nov 2002
Posts: 1,423
Original Thread
12-24-2006 20:48
/15/b4/155356/1.html
_____________________
i've got nothing. ;)