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 llScaleTexture(float u, float v, integer face)
void llLinkPlaySound(integer linknumber, string sound, float volume, integer flags)
integer llGetPermissions()
string llStringToBase64(string str)
vector llWind(vector offset)
void llRegionSay(integer channelID, string text)
list llListReplaceList(list dest, list src, integer start, integer end)
void llDie()