Difference between revisions of "Touch end"

From Second Life Wiki
Jump to navigation Jump to search
(same again)
(and again)
Line 18: Line 18:
         llOwnerSay((string)(llGetTime() - t) + " seconds between touch_start and touch_end");
         llOwnerSay((string)(llGetTime() - t) + " seconds between touch_start and touch_end");
     }
     }
}</lsl><lsl>// A minor concern to take note of...
}</lsl><lsl>// If using a touch to change states be careful about the touch_ event order...
 
// On clicking a prim with touch events we trigger touch_start (as), touch (during) and touch_end (as released).
// The chain of events is established in the script as touch_start is triggered that remains intact until either
// touch_end is triggered or a new touch_start (discounting resets, deletions, taking to inventory etc.).
default
default
{
{
Line 26: Line 32:
         llSay(0, "You just started touching me so I'm going to the other state...");
         llSay(0, "You just started touching me so I'm going to the other state...");
         state other;
         state other;
     }
     }// A very rapid click would theoretically beat the state change so the script would not behave as expected.
}
}
state other
state other
Line 32: Line 38:
     touch_end(integer nd)
     touch_end(integer nd)
     {
     {
         llSay(0, "The touch that brought you here just ended so I'm off...");
// The average click will have you catapult through this state with nothing but a chatted message to remember it by.
         llSay(0, "The touch that brought you here just ended so I'm going back to default...");
         state default;
         state default;
     }
     }

Revision as of 00:53, 31 January 2010

Description

! Event: touch_end( integer num_detected ){ ; }

Triggered when agent stops clicking on task

• integer num_detected

Caveats


Examples

You can use numbers 0 through num_detected - 1 to get detected agent keys: <lsl>float t;

default {

   touch_start(integer num_detected)
   {
       t = llGetTime();
   }
   touch_end(integer num_detected)
   {
       llOwnerSay((string)(llGetTime() - t) + " seconds between touch_start and touch_end");
   }

}</lsl><lsl>// If using a touch to change states be careful about the touch_ event order...

// On clicking a prim with touch events we trigger touch_start (as), touch (during) and touch_end (as released).

// The chain of events is established in the script as touch_start is triggered that remains intact until either

// touch_end is triggered or a new touch_start (discounting resets, deletions, taking to inventory etc.).

default {

   touch_start(integer nd)
   {
       llSay(0, "You just started touching me so I'm going to the other state...");
       state other;
   }// A very rapid click would theoretically beat the state change so the script would not behave as expected.

} state other {

   touch_end(integer nd)
   {

// The average click will have you catapult through this state with nothing but a chatted message to remember it by.

       llSay(0, "The touch that brought you here just ended so I'm going back to default...");
       state default;
   }

}</lsl>

See Also

Events

•  touch_start
•  touch

Functions

•  llPassTouches

Deep Notes

Issues

All Issues

~ Search JIRA for related Issues
   Server drops first touch event when a script returns to a state with a touch_start handler

Signature

event void touch_end( integer num_detected );