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
void llWhisper(integer channelID, string text)
key llRequestDisplayName(key id)
void llGroundRepel(float height, integer water, float tau)
string llGetHTTPHeader(key request_id, string header)
string llJsonGetValue(string json, list specifiers)
void llSetParcelMusicURL(string url)
float llGetCameraAspect()
string llGetObjectName()