Don't click here unless you want to be banned.

LSL Wiki : llDetectedKey

HomePage :: PageIndex :: RecentChanges :: RecentlyCommented :: UserSettings :: You are crawl338.us.archive.org
key llDetectedKey(integer number)

Returns the key of detected object number (returns NULL_KEY if number is not valid sensed object).

Note: The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events.

Q: Is this a 0-based or 1-based index?
A: 0-based; This function starts counting at 0. -Chris

Example:
// By James Benedek
// llDetectedKey and llGetOwner Example.
default {
       collision_start(integer num_detected)
          {
           if (llDetectedKey(0) == llGetOwner())
           {
             llSay(0,"Hi, Owner!!!");
          }
           else
          {
           llSay(0,"YOU ARE NOT MY OWNER!");
    }
}
}

// Alternate example by Wouter Hobble
// llDetectedKey if there might be multiple keys detected.
default
{
   collision(integer num_detected)
   {
        integer i = 0;
        while ( i < num_detected)   // Shout something for every key detected.
        {
            llShout(0, "Colliding Key: " + llDetectedKey(i));
            ++i;
        }
   }
}


This article wasn't helpful for you? Maybe the related article at the LSL Portal is able to bring enlightenment.

Functions | Detection | Sensors
There are 4 comments on this page. [Display comments/form]