Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

detect group members only

Cash Blitz
Registered User
Join date: 8 Jun 2008
Posts: 5
08-04-2008 05:19
Hi,

i'm using the following script to detect nearby avatars, and my problem is that i need one that only detects group members (members of the same group as the object is set to), and ignores everyone else.

[PHP]

touch(integer num_detected)
{
llSensor("", "", AGENT, range, PI);

}
sensor (integer numberDetected)
{

string msg = "Detected " + (string)numberDetected + " avatar(s): " + llDetectedName(0);
integer i = 0;
while(numberDetected > ++i)
{
msg += ", " + llDetectedName(i);
}
llSay(0, msg);
}

[/PHP]

What do i need to change?

Thanks in advance,
Cash
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
08-04-2008 05:32
http://www.lslwiki.net/lslwiki/wakka.php?wakka=llDetectedGroup
Happy scripting:)
_____________________
From Studio Dora
Damanios Thetan
looking in
Join date: 6 Mar 2004
Posts: 992
08-04-2008 06:22
http://lslwiki.net/lslwiki/wakka.php?wakka=llSameGroup

For superfluous completeness.
Sometimes more useful if you can't use detection.
_____________________
Cash Blitz
Registered User
Join date: 8 Jun 2008
Posts: 5
08-07-2008 05:28
thanks guys, but how can i use those to detect only the members of the group?


It doesn't let me to set up a filter in llSensor using those functions, so it still returns the number of all nearby avatars.

CODE


touch(integer num_detected)
{
llSensor("", "", AGENT, range, PI);

}
sensor (integer numberDetected)
{

string msg = "Detected " + (string)numberDetected + " avatar(s): " + llDetectedName(0);
integer i = 0;
while(numberDetected > ++i)
{
if (llDetectedGroup(i))
{
msg += ", " + llDetectedName(i);
}
}
llSay(0, msg);
}




it just doesn't show the name of avatars that are not in the group. But integer numberDetected is still the number of all nearby avatars, not only group members.
Can someone show me what exactly i need to change in the code? :) I'm not an expert yet.

Thanks,

Cash
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
08-07-2008 07:07
From: Cash Blitz
integer numberDetected is still the number of all nearby avatars, not only group members.
Can someone show me what exactly i need to change in the code?
Sensors can't be filtered by group affiliation/tag, only the results can. Sorry.