Jump to content

llSensor - Name wildcard?


Moon Corrigible
 Share

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

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

Recommended Posts

I apologize, I don't know the correct terminology.

I'm using an llSesnor and I would like it to detect both objects with the name "Left Corner Setter" and "Right Corner Setter".  Is there a way to use a character or code to to get it to detect anything with the words 'Corner Setter' in the name?

 

Thanks!

 

Link to comment
Share on other sites

Assuming that the objects are fairly nearby and that there aren't a lot of other objects within range, you can look for anything within range and then filter the results to find what you are looking for:

So, use llSensor("","",ACTIVE|PASSIVE,10.0);

and then receive

sensor(integer num)
{
    while (~num)
    {
        --num;
        if ( llSubStringIndex(llDetectedName(num),"Corner Setter") != -1 )
        {
            //Got one!  Now do something with it.
        }
    }
}

Build on that idea to create a short list of objects with the right name and then do whatever with them.  You are limited by the detection range and by the fact that a sensor will only report the 16 closest objects it detects within range.

Edited by Rolig Loon
Clarity
  • Like 1
Link to comment
Share on other sites

I'm just a little worried that there might be more than 16 scripted objects in the vicinity, and that the sensors might not find it then.  But honestly I have no idea how realistic that worry is.

Dumb question - would running two sensors (one for each) take up less script resources?  I read that each llSensor will return up to 16 responses and I'm wondering if that would be overly taxing?

 

Thanks again!

Link to comment
Share on other sites

1 minute ago, Moon Corrigible said:

Dumb question - would running two sensors (one for each) take up less script resources?

Unless you plan on looking over and over and over, that's a non-worry.  I assume that you just need to find the objects once, do something, and be happy.

Link to comment
Share on other sites

If I may suggest another approach:

Give your target prims the same name but then differentiate them by giving each one a unique description i.e. "left" or "right". That way, you could set your sensor to look for all objects named "Corner Setter" and then inspect each detected prim's description with llGetObjectDetails to figure out if it was the left or right variant.

  • Like 4
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1618 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...