llSensor
LSLvoid llSensor(string name, string id, integer type, float range, float arc)
Performs a single scan for Name and ID with Type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within Range meters and Arc radians of forward vector.\ Specifying a blank Name, 0 Type, or NULL_KEY ID will prevent filtering results based on that parameter. A range of 0.0 does not perform a scan.\ Results are returned in the sensor and no_sensor events.
Parameters
| Type | Name | What it does |
|---|---|---|
| string | name | Only this name, or "". |
| string | id | Only this key, or NULL_KEY. |
| integer | type | AGENT, ACTIVE, PASSIVE or SCRIPTED, combinable with |. |
| float | range | Metres, up to 96. |
| float | arc | Radians either side of the prim's forward axis; PI is all round. |
Example
default
{
touch_start(integer n)
{
llSensor("", NULL_KEY, AGENT, 20.0, PI);
}
sensor(integer found)
{
integer i;
for (i = 0; i < found; ++i)
llSay(0, llDetectedName(i) + " is " + (string)llRound(llVecDist(llGetPos(), llDetectedPos(i))) + " m away");
}
no_sensor()
{
llSay(0, "Nobody within 20 m.");
}
}
Energy
10
The Linden Scripting Library — what every SL-compatible grid provides.
More in LSL
key llGetLinkKey(integer linknum)
integer llGetRegionDayLength()
void llApplyRotationalImpulse(vector force, integer local)
float llList2Float(list src, integer index)
void llSetCameraParams(list rules)
list llListInsertList(list dest, list src, integer start)
integer llSetLinkMedia(integer link, integer face, list rules)
integer llGetInventoryPermMask(string item, integer mask)