LlDetectedType

From Second Life Wiki

Jump to: navigation, search

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

Summary

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 usable values if called from within Detection events (collision, collision_start, collision_end, sensor, touch, touch_start, touch_end) 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.
Flag Description
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

  • If number is out of bounds the script continues to execute without an error message.
  • 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.

Search JIRA for related Bugs

Examples

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

See Also

Articles

•  Detected

Deep Notes

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