Hi, I wonder if is it possible to launch properly several sensors (or sensor repeats) in pararel. My script detects and display the number of prims in a specific area. Preciesly, it will detect the number of prims which are between xx and xx m. The script will also detect and display all xx seconds The number of prims doesn't create me difficulties. I just need to make a substract. The only problem is how to launch not an only range values, but multiples range values at the same time (a list of range values) I tried : -llSensor loop, llSleep and reset the script (and the variables) : Randomly works. It display nothing like it display the second first range values and his numbers of prim but not the others -Use a llSensorRepeat, create a second state, enter in this state and comeback to default state : Display the next range value and the number of prims in here Here is the script of the first solution. In this script, I choose to detect the number of prims which are under 5m, between 5 and 10m and between 10 and 50m : list areas = [5,10,50];
list primList = [];
integer previousPrimsNumber = 0;
integer primsNb =0;
integer firstIndex = TRUE;
integer areaID=0;
default
{
state_entry(){
state countPrims;
}
}
state countPrims
{
state_entry()
{
integer i;
for(i=0;i<llGetListLength(areas);i++){
llSensor( "","", PASSIVE, llList2Integer(areas,i), PI);
}
}
sensor (integer numberDetected)
{
if(firstIndex){
previousPrimsNumber = numberDetected;
primsNb = numberDetected;
firstIndex=FALSE;
}else{
primsNb = numberDetected-previousPrimsNumber;
previousPrimsNumber += primsNb;
}
primList = llListInsertList(primList, [primsNb], llGetListLength(primList));
areaID++;
if(areaID == llGetListLength(areas)){
state displayState;
}
}
no_sensor()
{
llOwnerSay("Nothing here");
state displayState;
}
}
state displayState
{
state_entry()
{
integer j;
for(j=0;j<llGetListLength(zones);j++){
llOwnerSay("On "+(string)llList2Integer(areas,j)+" m: "+(string)llList2Integer(primList,j));
}
state waitState;
}
}
state waitState
{
state_entry()
{
llOwnerSay("Wait...");
primList = [];
previousPrimsNumber = 0;
primsNb =0;
areaID=0;
llSleep(5.0);
llOwnerSay("Reset");
state primsNbtate;
}
} I am open to any suggestions. Have a nice day !