Jump to content

Sensor all except owner (Detect Everyone Except Owner)


Rhemah
 Share

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

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

Recommended Posts

i basically want to create an object that will look at all other avatars but will never look at the the owner. Im not sure if it is possible. I look on the type flag mask at lsl wiki but i can't seem to get it right. A little help pls.

 

float time = 1.0;
default
{

state_entry()

{
llSetTimerEvent(time);
}
sensor(integer num)
{
llLookAt(llDetectedPos(0),1,0);

}

timer()
{
llSensor("","",AGENT_BY_USERNAME,6,PI);
}
}

Link to comment
Share on other sites

  • 4 years later...

Hello, i have the similiar problem but in another case:

        llSensorRepeat("","",AGENT,1000,2*PI,0.6);
    }
 sensor (integer num)
    {
        string message = "" + (string)num + " avatar(s): " + llDetectedName(0);
 llMessageLinked(LINK_SET, 2, "open", "");
        integer index = 1;
        integer i;
        while (index < num )
            message += ", " + llDetectedName(index++);

I added this lines from this topic 

{    if ( llDetectedKey(0) != llGetOwner() )    {

but in this case it seems not to work

  • Like 1
Link to comment
Share on other sites

3 hours ago, w0o said:

llSensorRepeat("", "", AGENT, 1000, 2*PI, 0.6);

Two things;

  1. The maximum range for a sensor is 96 meters, not 1000.
  2. The maximum arc is PI, not 2*PI. (There's also a constant TWO_PI which is 2*PI.)

And as more of a side-note, sensors only detect up to 16 things. Even if you are ignoring the owner, it will still be included in the results, so the most actionable targets you can find in that case is 15.

Edited by Wulfie Reanimator
  • Like 2
Link to comment
Share on other sites

w0o, instead of sensors you may use llGetAgentList(), which is usually less resource heavy, if you like to get info from the whole region - 1000m distance suggests that... as Wulfie said, llSensor() has 96m scan limit - llGetAgentList() also gets up to 100 people max, not just 16. Small example below, with incorporated code fragment of yours.

default
{

    state_entry()
    {
        llSetTimerEvent(0.6);
    }

    on_rez(integer sp)
    {
        llResetScript();
    }

    timer()
    {
        key ownerKey = llGetOwner();
        list avatars = llGetAgentList(AGENT_LIST_REGION, []);
        integer avatarsCount = llGetListLength(avatars);
        if (avatarsCount > 0)
        {
            llMessageLinked(LINK_SET, 2, "open", "");
            integer i;
            list message = [];
            while (i < avatarsCount)
            {
                key avatarKey = llList2Key(avatars, i);
                if (avatarKey != NULL_KEY && avatarKey != ownerKey)
                {
                    message = message + llKey2Name(avatarKey);
                }
                ++i;
            }
            llOwnerSay((string)avatarsCount + " avatar(s): " + llDumpList2String(message, ", "));
        }
    }

}

 

Edited by panterapolnocy
Link to comment
Share on other sites

You forget that sensors can detect avatars in the neigbours sim . ( avatars in a border between two different sims ) .

llGetAgenList can t do this feature

So : the choice of woo  can be dependant of his environnement  and what is  the goal to detect  avatars 

Edited by Miranda Umino
Link to comment
Share on other sites

Well... http://wiki.secondlife.com/wiki/LlSensor

Quote

llSensor does not detect objects or agents across region boundaries.

I'll be honest, I'm not telling that what you say is not true, but I'm sticking with the wiki - as I've actually never used llSensor() to detect someone over the region border. Never had a need to do it. ;)

Maybe you've had llRegionSay in mind? llSay, llWhisper, llShout do cross region borders, llRegionSay/To does not.

Edited by panterapolnocy
Link to comment
Share on other sites

if you create vehicles you will need more than llgetagentlist

and this info is inside the wiki even if it s not in the page dedicated to  llgetagentlist

 

And if you tell it won t interest woo , why to detect a full region with  AGENT_LIST_REGION and not to detect only avatars in a parcel with AGENT_LIST_PARCEL ,   who will be more efficient in resources ?

Edited by Miranda Umino
Link to comment
Share on other sites

1 hour ago, Miranda Umino said:

if you create vehicles you will need more than llgetagentlist 

I don't know what vehicles have to do with this topic. It's about getting avatars list without the script owner.

1 hour ago, Miranda Umino said:

and this info is inside the wiki even if it s not in the page dedicated to  llgetagentlist

Well, quote please. ;) I'm just saying that llSensor has most probably the same limitations as llGetAgentList across region boundaries, as pointed out at the wiki.

1 hour ago, Miranda Umino said:

And if you tell it won t interest woo

I didn't say anything like that. :D I've just pointed out, that if w0o was aiming at 1000m detection range, then they most probably wanted to cover whole region, or at least as much field as possible. llGetAgentList along with AGENT_LIST_REGION is best for that, under these circumstances - you're asking region / simulator itself for a simple avatars list instead of firing a sensor that must filter out everything on its way, in a spherical 3D shape.

Edited by panterapolnocy
Link to comment
Share on other sites

Woo has chosen to limit at 1000 meters : but llgetagentlist detect to 4096 meters ( in height .. ) So how do you know he watend to cover even after 1000 meters ?

And how do you know in reading woo post that he wants to detect avatars in a non-sherical shape ?

Edited by Miranda Umino
Link to comment
Share on other sites

11 hours ago, Miranda Umino said:

but llgetagentlist detect to 4096 meters

Easy to fix, just a llVecDist is needed. ;)

    timer()
    {
        vector currentPos = llGetPos();
        key ownerKey = llGetOwner();
        list avatars = llGetAgentList(AGENT_LIST_REGION, []);
        integer avatarsCount = llGetListLength(avatars);
        if (avatarsCount > 0)
        {

            integer i;
            list message = [];
            while (i < avatarsCount)
            {
                key avatarKey = llList2Key(avatars, i);
                if (avatarKey != NULL_KEY && avatarKey != ownerKey && llVecDist(currentPos, llList2Vector(llGetObjectDetails(avatarKey, [OBJECT_POS]), 0)) <= 1000)
                {
                    message = message + llKey2Name(avatarKey);
                }
                ++i;
            }

            integer avatarsCountToReport = llGetListLength(message);
            if (avatarsCountToReport > 0)
            {
                llMessageLinked(LINK_SET, 2, "open", "");
                llOwnerSay((string)avatarsCountToReport + " avatar(s): " + llDumpList2String(message, ", "));
            }

        }
    }

 

11 hours ago, Miranda Umino said:

And how do you know in reading woo post that he wants to detect avatars in a non-sherical shape ? 

I don't. Just offering an alternate solution that would go beyond 96m? I'm pretty sure w0o is going to pick what they like, if not already did that. :)  Also, pssst... with llVecDist spherical shape is kinda simulated! ;)

Edited by panterapolnocy
Link to comment
Share on other sites

except you have detected more avatars thet you should .. :)

llvectdist changes for the  final operation , but it doesn t disallow to your list fetched by llgetagentlist is too big  , and of course , it limts the total size of your script because you will need to store this list :)

Edited by Miranda Umino
Link to comment
Share on other sites

16 minutes ago, Miranda Umino said:

except you have detected more avatars thet you should .. :)

llvectdist changes for the  final operation , but it doesn t disallow to your list fetched by llgetagentlist is too big  , and of course , it limts the total size of your script because you will need to store this list :)

100 keys is only 10KB out of the 64KB a script can use.

Edited by Wulfie Reanimator
Link to comment
Share on other sites

Thanks for so many replys, it all helped and brings me new ideas, because i am noob in this :(

WIth the 1000m in LLsensors i was just trying out some bug discribed, which can, in some cases detect higher distances over 9

 

But my first problem was not solved

Here is an example of the 3 spots where i tried to exclude the owner but it still detects me, even if i leave all 3 or just one at each spot

in  it. 

 sensor (integer num)
    {
        string message = "detected" + (string)num + " avatar(s): " + llDetectedName(0) != llGetOwner());    //here 
 llMessageLinked(LINK_SET, 2, "open", "");
    //  we already added the first avatar above, so continue from index 1
        integer index = 1;
        integer i;
        while (index < num )
        {
       if(llDetectedKey(index) != llGetOwner())  //here 
       {
            message += ", " + llDetectedName(index++) != llGetOwner();  //or here 
 
        llWhisper(PUBLIC_CHANNEL, message);
    }
    no_sensor()

maybe an issue with detect names vs keys?

all other cases where i played with noowner sensor cases worked for me with just one line :)

 

Link to comment
Share on other sites

If you really insist on using llSensor(), then just try this one.

    sensor (integer num)
    {
        llMessageLinked(LINK_SET, 2, "open", "");
        integer index;
        integer avatarsCount;
        list message;
        while (index < num)
        {
            if (llDetectedKey(index) != llGetOwner())
            {
                message = message + llDetectedName(index);
                ++avatarsCount;
            }
            ++index;
        }
        llWhisper(PUBLIC_CHANNEL, "detected " + (string)avatarsCount + " avatar(s): " + llDumpList2String(message, ", "));
    }

 

Link to comment
Share on other sites

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