You can use numbers 0 through (num_detected-1) with the various llDetected... functions to get detected agent keys etc. For most purposes, it is adequate to bother only with the first detected toucher e.g. llDetectedKey(0). It is rare (but not impossible) for num_detected to be other than 1.
default
{
touch(integer num_detected)
{
llOwnerSay("I am being touched by " + llDetectedName(0) + ".");
}
}
This next example demonstrates detecting when the owner of the object clicks-and-holds on the object for 1 second in order perhaps to access a management menu or similar, Normal brief clicks are distinguished.
default
{
touch_start(integer num_detected)
{
llResetTime();
}
touch(integer num_detected)
{
if (llDetectedKey(0) == llGetOwner() && llGetTime() > 1.0)
{
// The owner has touched this object for longer than 1 second
// execute some special feature such as issuing a management dialog
// ...
}
}
touch_end(integer num_detected)
{
if (llGetTime() < 1.0)
{
// The user did a normal quick click on the object
// execute actions for normal clicks
// ...
}
}
}