Jump to content
Sign in to follow this  
Rhemah

AGENT_LIST_PARCEL exclude owner from the list?

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

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

Recommended Posts

list agents= llGetAgentList(AGENT_LIST_PARCEL, []);
integer listlength= llGetListLength(agents); integer loop;

is there any way that we can exclude the owner from the list?

Share this post


Link to post
Share on other sites

Like this?

        list agents= llGetAgentList(AGENT_LIST_PARCEL, []);        integer i = llGetListLength(agents);        if (i) {
do { if (llList2Key(agents, i) == llGetOwner()) agents = llDeleteSubList(agents, i, i); } while (--i > -1);
}

Share this post


Link to post
Share on other sites

Or this?

list agents= llGetAgentList(AGENT_LIST_PARCEL, []);integer i = llListFindList( agents, [llGetOwner()]);if ( i > -1 ) agents = llDeleteSubList( agents, i, i);

:smileysurprised::):smileyvery-happy:

Share this post


Link to post
Share on other sites
float range = 10.0;some_event() {    list agents = llGetAgentList(AGENT_LIST_PARCEL, []);    integer i = llGetListLength(agents); integer loop;    do {        key avatar = llList2Key(agents,loop);        if(range)         {            // something event here        }    } while(++loop < i);}

something like this

Share this post


Link to post
Share on other sites

Dora has allready given the answer. The do while loop is not needed. One does not do loop searches on lists, it is just pointless and a waste of resources.

EDIT. Not what you was asking but can not see what difference it makes whether the owner is in the list. A simple ignore owner statement will do..

Share this post


Link to post
Share on other sites

        key avatar = llList2Key(agents,loop);

float distance = llVecDist(llGetPos(), llList2Vector(llGetObjectDetails(avatar, [OBJECT_POS]), 0));

if (distance <= range && avatar != llGetOwner())

{

// something event here

}

Share this post


Link to post
Share on other sites

Am some what confused by this "something event here", events do not trigger in side a code block as has been posted. An event invokes the code block.

 

Share this post


Link to post
Share on other sites

Don't worry about the word "event", Steph.  He just meant "Some activity happens here", using the word "event" in the normal sense that we use it in daily life.  :smileywink:

Share this post


Link to post
Share on other sites
float range = 10.0;some_event() {    list agents = llGetAgentList(AGENT_LIST_PARCEL, []);    integer i = llGetListLength(agents); integer loop;    do {        key avatarkeys= llList2Key(agents,loop);        if(range)         {          llRegionSayTo(avatarkeys, -12345, "constant command here");        }    } while(++loop < i);}

well i didn't write it down but what i really wanted to do is a continous giving of command until this script dies,

Share this post


Link to post
Share on other sites

Why are you looping thru the list? You do not loop thru lists, your store them and dump and clear, not create a stack heap crash.

Share this post


Link to post
Share on other sites

Noooo..  That's wasteful and, as Steph says, likely to just lock up your script.  Do your llGetAgentList and the cleanup once, then trigger a timer to do it again maybe 10 seconds later, and repeat the timer.  There's no need to whip through that business more often than once every few seconds.  In fact, I normally repeat it only once every 30 seconds or so.

Share this post


Link to post
Share on other sites

I think there's some confusion here. This snippet looks reasonable, mostly. Every some_event, it does an llGetAgentList() and then spams a string on an obscure channel to everyone on the list -- presumably to their attachments listening on that channel.

You probably don't want to test "if(range)" where range is a float. Maybe the intent is to test for a maximum distance between something and the agent on the list, but that takes more work -- and I'm not sure that's what's intended anyway.

Also, just by convention, when "i" appears as a variable, it is most often a loop iterator, a role played in this script by the variable named "loop" -- likely to confuse experienced programmers at first glance. (The plural variable name "avatarkeys" to refer to a singleton is confusing, too.)

Oh, and yeah, you could test inside that loop for a match with the owner key, to skip past them in the loop.

Share this post


Link to post
Share on other sites

whats the point of doing a loop for an UUID when the server will do it at a speed beyond comprihension. Unless i missing you point?

Share this post


Link to post
Share on other sites

yeah i know what everyone is saying and that there is much easier way etc, but the question i have in mind for this thread when i open it is, is there a way for me to prevent the owner from receiving the llRegionSayTo command? I'm not asking for alternatives. This is more like an area of effect that lasts for 3 seconds only in max 10meters. So in the code that i gave, im asking if there is a way for the owner not to get involve in the area of effect, if there is kindly help me.

Share this post


Link to post
Share on other sites


steph Arnott wrote:

whats the point of doing a loop for an UUID when the server will do it at a speed beyond comprihension. Unless i missing you point?

Unless I miss the point, the code is trying to issue a command to everybody in the list (except the owner), and that was the whole point of getting the agent list. So if it doesn't loop through the list, I don't see how it's going to do that.

(That said, it would almost certainly be much cheaper to simply broadcast the command with llWhisper and rely on the llListen() distance to filter the range. I'm not sure why we're not doing that, but we started with llGetAgentList, so we'll pretend it's an okay approach.)

Share this post


Link to post
Share on other sites


Qie Niangao wrote:

[ .... ]

(That said, it would almost certainly be much cheaper to simply broadcast the command with llWhisper and rely on the llListen() distance to filter the range. I'm not sure why we're not doing that, but we started with llGetAgentList, so we'll pretend it's an okay approach.)

The OP's basic question was answered in a couple of different ways already.  Dora's answer is the simplest.  I agree, though, that there's no apparent reason for getting the names of everyone in the region anyway.  If all you want to do is send a message to everyone except the owner, you just write

llRegionSay(0,"Hi, guys!  This is a message.");

And then you mute your own object so you can't hear its message.  ;)

Share this post


Link to post
Share on other sites
You are about to reply to a thread that has been inactive for 1614 days.

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...