Touch start

From Second Life Wiki

Jump to: navigation, search

Template:Needs Translation/LSL/de Template:Needs Translation/LSL/es Template:Needs Translation/LSL/el Template:Needs Translation/LSL/he Template:Needs Translation/LSL/it Template:Needs Translation/LSL/ko Template:Needs Translation/LSL/nl Template:Needs Translation/LSL/hu Template:Needs Translation/LSL/no Template:Needs Translation/LSL/da Template:Needs Translation/LSL/sv Template:Needs Translation/LSL/tr Template:Needs Translation/LSL/pl Template:Needs Translation/LSL/pt Template:Needs Translation/LSL/ru Template:Needs Translation/LSL/uk Template:Needs Translation/LSL/zh-Hans Template:Needs Translation/LSL/zh-Hant

Contents

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[c]

Examples

You can use numbers 0 through num_detected - 1 to get detected agent keys:

default
{ 
    touch_start(integer num_detected)
    {
        integer i = 0;
        for(; i<num_detected; ++i)
            llWhisper(0, "Touched by " + llKey2Name(llDetectedKey(i)));
    }
}
// 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 (and does if your VERY quick) beat the state change so the script would/does 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;
    }
}

Deep Notes

Issues

Bug - A problem which impairs or prevents the functions of the product. Open - The issue is open and ready for the assignee to start work on it.    Server drops first touch event when a script returns to a state with a touch_start handler
This article wasn't helpful for you? Maybe the related article at the LSL Wiki is able to bring enlightenment.
Personal tools
In other languages