// Configure the sensor parameters float SENSOR_RANGE = 10.0; // The distance in meters to sense avatars integer SENSOR_INTERVAL = 5; // The interval in seconds for checking // Initialize light properties vector LIGHT_COLOR = <1.0, 1.0, 0.0>; // Yellow light float LIGHT_INTENSITY = 1.0; // Intensity of light float LIGHT_RADIUS = 10.0; // Radius of the light float LIGHT_FALLOFF = 1.0; // Light falloff default { state_entry() { llSensorRepeat("", NULL_KEY, AGENT, SENSOR_RANGE, PI, SENSOR_INTERVAL); } sensor(integer total_num) { // Detected an avatar, turn on the light llSetPrimitiveParams([ PRIM_POINT_LIGHT, TRUE, // Enable light LIGHT_COLOR, // Color of the light LIGHT_INTENSITY, // Intensity of the light LIGHT_RADIUS, // Radius of the light LIGHT_FALLOFF // Falloff of the light ]); } no_sensor() { // No avatars detected, turn off the light llSetPrimitiveParams([ PRIM_POINT_LIGHT, FALSE, // Disable light <0.0, 0.0, 0.0>, // Color (not needed when turned off) 0.0, // Intensity (not needed when turned off) 0.0, // Radius (not needed when turned off) 0.0 // Falloff (not needed when turned off) ]); } }