1 //originally written by Davide Byron
2 //this code is released under the GPLv3
4 // Produces E_AGENT_POSITION and E_NO_SENSOR event
5 // Sensor have detected an agent, the position is passed as a string
6 // Sensor have not detected anything, no params
8 // this sensor is a kind of eye for the creature. Almost everything about the external world
9 // is known via this script. Succesfully detecting food is a key feature for surviving.
11 //dedicated to Mealea, thanks for the passion you put into things and for being able to pass it on to me :)
14 integer E_AGENT_POSITION
= 1;
15 integer E_NO_SENSOR
= 5;
20 //vars used by the script, can be subkected to evolution one day...
21 float SensorRange
= 96.0;
22 float SensorFrequency
= 120.0;
41 llSensorRepeat("", "", AGENT
, SensorRange
, PI
, SensorFrequency
);
50 llMessageLinked(LINK_SET
, E_NO_SENSOR
, "", "");
55 //something in sight, investigate further
56 sensor(integer numberDetected
)
58 //pick a random object detected and broadcast it's coords within the animal body
59 integer target
= (integer)llFrand( numberDetected
);
60 llMessageLinked(LINK_SET
, E_AGENT_POSITION
, (string)llDetectedPos(target
), llDetectedKey(target
));