Jump to content

LlDetectedType

From OSgrid Wiki

Function: integer llDetectedType( integer number );

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 agents only.
ACTIVE 0x2 This is used to find physical objects that are moving or objects containing an active script.
PASSIVE 0x4 This is used to find physical objects that are not moving or non-physical objects containing an inactive script or a non-scripted object.
SCRIPTED 0x8 This is used to find objects containing an active script.

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

<source lang="lsl">

//--// 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);
 }

} </source>