Difference between revisions of "Touch start"

From Second Life Wiki
Jump to: navigation, search
(Added some more refernec funtions to do with touches.)
(added example of a state change issue with touch_start & _end)
Line 15: Line 15:
 
         for(; i<num_detected; ++i)
 
         for(; i<num_detected; ++i)
 
             llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
 
             llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
 +
    }
 +
}</lsl><lsl>// A minor concern to take note of...
 +
 +
default
 +
{
 +
    touch_start(integer nd)
 +
    {
 +
        llSay(0, "You just started touching me so I'm going to the other state...");
 +
        state other;
 +
    }
 +
}
 +
state other
 +
{
 +
    touch_end(integer nd)
 +
    {
 +
        llSay(0, "The touch that brought you here just ended so I'm off...");
 +
        state default;
 
     }
 
     }
 
}</lsl>
 
}</lsl>

Revision as of 09:16, 30 January 2010

Description

! Event: touch_start( integer num_detected ){ ; }

Triggered by the start of agent clicking on task

• integer num_detected Number of agents detected touching during the last clockcycle

Caveats

  • When changing from a state that lacks a touch event into a state that has a touch event, the first touch will be dropped; this effects all three touch events (touch_start, touch, touch_end). See: SVC-3017

Important Issues

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

Examples

You can use numbers 0 through num_detected - 1 to get detected agent keys: <lsl>default {

   touch_start(integer num_detected)
   {
       integer i = 0;
       for(; i<num_detected; ++i)
           llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
   }

}</lsl><lsl>// A minor concern to take note of...

default {

   touch_start(integer nd)
   {
       llSay(0, "You just started touching me so I'm going to the other state...");
       state other;
   }

} state other {

   touch_end(integer nd)
   {
       llSay(0, "The touch that brought you here just ended so I'm off...");
       state default;
   }

}</lsl>

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_start( integer num_detected );