Difference between revisions of "Moving end"

From Second Life Wiki
Jump to navigation Jump to search
(Added information about how keyframed motion triggers this event)
Line 7: Line 7:
**After adding or editing a script you must:
**After adding or editing a script you must:
***Take off the attachment and then wear the attachment again.
***Take off the attachment and then wear the attachment again.
 
*This event is triggered when an object finishes its [[LlSetKeyframedMotion|keyframed motion]], or when motion ceases via KFM_CMD_PAUSE or KFM_CMD_STOP
*This event is also triggered when an object is rezzed (unless, presumably, you happen to rez it in precisely the same spot it was before.)
*This event is also triggered when an object is rezzed (unless, presumably, you happen to rez it in precisely the same spot it was before.)
|examples=<lsl>
|examples=<lsl>

Revision as of 11:15, 20 September 2012

Description

! Event: moving_end( ){ ; }

Triggered when task stops moving


Caveats

  • The moving_start and moving_end events require special handling when scripting attachments.
    • After adding or editing a script you must:
      • Take off the attachment and then wear the attachment again.
  • This event is triggered when an object finishes its keyframed motion, or when motion ceases via KFM_CMD_PAUSE or KFM_CMD_STOP
  • This event is also triggered when an object is rezzed (unless, presumably, you happen to rez it in precisely the same spot it was before.)

Important Issues

~ All Issues ~ Search JIRA for related Bugs
   Behavior of moving_start() and moving_end() is inconsistent.

Examples

<lsl> //Physical Prim Movement Script //By Nika Rugani //With spam work around

vector pos; float move_time = 5; //Move every 5 seconds float increment = 5;

float power = 0.5; //The TAU

integer trigger_multiple = FALSE; // This bad boy will prevent spam of moving start event integer trigger_slave = 1;

setPhysical(integer status_physics) {

   llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_PHYSICS, status_physics]);

}

default {

   touch_start(integer num_detected)
   {
       if(llGetStatus(STATUS_PHYSICS) == FALSE)
       {
           pos = llGetPos(); //Set the objects default position
           setPhysical(TRUE);
           llSetTimerEvent(move_time);
       }
       else
       {
           setPhysical(FALSE);
           llSetPos(pos);
       }
   }
   moving_start()
   {
       if(trigger_slave == 0)
       {
           llOwnerSay("YEY!! I'm Moving!");
           if(trigger_multiple == FALSE)
           {
               trigger_slave = 1;
           }
       }
   }
   moving_end()
   {
       llSetTimerEvent(move_time);
   }
   timer()
   {
       llSetTimerEvent(0);
       if(llVecDist(pos, llGetPos()) > (increment-2))
       {
           llMoveToTarget(pos, power);
       }
       else
       {
           llMoveToTarget(pos+<0.0,0.0,increment>, power);
       }
       trigger_slave = 0;
   }

}</lsl>

See Also

Events

•  moving_start

Functions

•  llTarget
•  llRotTarget

Deep Notes

Issues

All Issues

~ Search JIRA for related Issues
   Behavior of moving_start() and moving_end() is inconsistent.

Signature

event void moving_end(  );