Jump to content

Sensing two different objects


LissomePrey
 Share

You are about to reply to a thread that has been inactive for 1164 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I want to detect the presence of either of two different objects but llSensor appears to restrict you to one.

Can I have two sensors outstanding at the same time or is it better to have one and switch the search between the two objects on a timed basis?

If the latter can I still use llSensorRepeat if the name parameter is a variable that I change in the event handling?

Link to comment
Share on other sites

Yeah, basically that. you could also name your objects the same, and 'filter' based on name though.

Another thing you might keep in mind is if you expect the object you're scanning for to /not/ be there most of the time, it might be nicer on the server to implement a messaging protocol with llShout() or llRegionSay() and llListen(), for example having the 'sensor object' say "PING" on a timer, and the thing you're detecting say "PONG" if it hears the ping and is within the correct range.

Link to comment
Share on other sites

One type of filter:

llSensor("My Object","",ACTIVE|PASSIVE, 20.0, PI);

sensor(integer num)
{
    while (~num)
    {
        string Desc = llList2String( llGetObjectDetails(llDetectedKey(num),[OBJECT_DESC]),0);
        if (Desc == "Type A")  { //do type A stuff}
        else if (Desc == "Type B") { //do type B stuff}
        --num;
    }
}

 

  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1164 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...