Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Help With Groups Required

Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
01-05-2008 07:14
Hi guys!

I need a bit of help with groups. I basically want to be able to allow members of a group to be able to operate my stuff if it's deeded.

What I need to do is basically something along these lines:

if (groupowned){
operator = any_member_of_owner_group;
} else {
operator = owner;
}

How exactly I do that with LSL though I'm not sure and I can't quite seem to find it with search (I'm 100% sure someone's asked previously. Maybe I'm searching for the wrong thing?)

I'd appreciate any and all help with this. Thanks
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
01-05-2008 07:29
Use llSameGroup(). If the object's group membership is the same as the avatar interacting with it (as returned by llDetectedKey for example) it returns TRUE.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
01-05-2008 08:00
OK, I see the function, but I'm still unsure of how to implement it. How do I tell the script to establish whether it's someone in the group OR the owner who clicks it? Do I say something like:

if ((llDetectedOwner(0) == llGetOwner()) || llSameGroup(llDetectedOwner(0))){
WORK;
}

Or have I missed something?
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Monica Balut
Beam-Me
Join date: 18 Feb 2007
Posts: 311
01-05-2008 10:16
Well it depends on the context from which you derive the id of the user. The llDetected* functions will only return a meaningful value in the collision(), collision_start(), collision_end(), sensor(), touch(), touch_start(), or touch_end() events. You may also get the id from a listen event as a parameter in listen() from chat or a dialog.

So, assuming you have gotten a valid key for the user from one of the means above, you'd have something like this.

CODE


if ( user == llGetOwner() || llSameGroup(user))
{
Do something
}



Remember that the object's properties must be set so the object belongs to the same group as the user, and the user's active group must be the same as the object's.
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
01-05-2008 11:59
OK, I've tried it and it worked as I suggested above but that was as a touch_start() event. I wish I knew it was that easy previously. I may be a little overzealous with the parentheses mind you :D

Thanks a lot for your help
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Landing Normandy
Proposing 4968
Join date: 28 Nov 2005
Posts: 240
01-05-2008 12:11
Another question I guess; is it possible to programme in a group; say a support group who can operate a device even if they're not the owners etc? I've never seen how to get a groups UUID. I assume I could just deed something to the desired group and have it tell me its owners UUID could I? Then maybe have an option where if someone from the support group clicks the device a debug menu is provided?
_____________________
<VOTE PROPOSITION 4968/>
http://jira.secondlife.com/browse/VWR-4968
For SecondLife Builders who need better mapping for better building
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
01-05-2008 12:32
You can get a group's UUID (e.g. by deeding an object to the group and then printing out llGetOwner()), but you cannot test whether a resident belongs or is set to a group with a particular UUID. You are stuck with testing whether the object and resident are set to the same group unless you use some kind of external database to maintain a group list in parallel and/or use some kind of custom client solution to give you a group member test API.
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
01-05-2008 12:34
you can get the group uuid a few ways, but the simplest would be to use advanced search inworld, limit it to groups, search for your group name, then click the name of your group... at the bottom of that page is an http addres, the last part of which will be the group uuid... it can be used to find ANY group uuid...

the problem is you have no way of comparing it to an av, because both llSameGroup() and llDetectedGroup() return a true/false comparison to the objects group, rather than to an arbitrary one.

a possible workaround would be to set up the support group as invitation only, allow support personal to invite users in and then have them set the object to group (not deeded or shared), then go forward from there... the drawback would be that while the user is in the group they would be able to trigger any special functions also.

it might be possible to limit that by checking permissions as well, but that might require the object to be shared (not sure it's been awhile since I played with this... about 2-3 years, alot has changed).
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -