LlDetectedType

From Second Life Wiki

(Redirected from LSL llDetectedType)
Jump to: navigation, search

Contents

Description

Function: integer llDetectedType( integer number );
34 Function ID
0.0 Delay
10.0 Energy

Returns an integer mask that is the types of detected object or avatar.

• integer number Index of detection information


number does not support negative indexes.
Returns zero if number is not valid sensed object or avatar.

Specification

llDetected* functions can be called anywhere but will only return non-default values if called from within Detection events and functions called by Detection events.

Flag Description
AGENT 0x1 This is used to find avatars only.
ACTIVE 0x2 This is used to find objects that are moving.
Flag Description
PASSIVE 0x4 This is used to find objects that are not moving.
SCRIPTED 0x8 This is used to find objects that have a script attached to them.

Caveats

  • Events that enable the llDetected* functions always return at least one detected item.
    • Detection events are not raised if there is nothing detected (with the slight exception of no_sensor but it doesn't enable llDetected* functions).
    • The event detection count parameter value is initially never less than 1.

Examples

 
//--// Type & name of collision source //--//
 
default{
  collision_start( integer vIntCollided ){
    integer vBitType;
    string vStrType;
    do{
      vBitType = llDetectedType( --vIntCollided );
      if (1 & vBitType){
        vStrType = "Avatar";
      }else{
        vStrType = "object";
      }
      llOwnerSay( "An " + vStrType + "named '" + llDetectedName( vIntCollided ) + "' collided with me" );
    }while (vIntCollided);
  }
}
 

See Also

Articles

•  Detected
Personal tools