llSameGroup Question
|
|
Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
|
02-11-2006 16:48
Ok, anyone used the llSameGroup command? I would like to add it to a gadget so that the gadget (when worn) will only work when the person wearing it is in the correct group.
However, the problems start with the fact I can't control the person from changing the group of the item, so, what I was thinking was getting the group key and hard coding it into the script and then checking against that. But, I can't figure out HOW to get the stupid group key of a group. So, instead of beating my head against a wall, was hoping someone here would have a solution.
Thanks.
=Riz
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
02-11-2006 16:50
make a script that spouts out llGetOwner Info when touched, and then deed it to the group
|
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
02-11-2006 17:28
From: Rizado DaSilva However, the problems start with the fact I can't control the person from changing the group of the item. key GroupKey = "0f1641a1-6827-8480-0737-e2aaa2636236"; string GroupMemberName = "Live Helper"; string GroupName = "Live Help";
default { touch_start(integer total_number) { if(llSameGroup(llGetKey()) == llSameGroup(GroupKey)) { if(llSameGroup(llDetectedKey(0))) { llSay(0,"Hello, " + GroupMemberName + " " + llKey2Name(llDetectedKey(0))); } else { llSay(0,"You must be a member of " + GroupName); } } else { llSay(0,"I am not set to the correct group, " + GroupName); } } } If you are in the group, you can find it here , click one of the links for the name and it will be the list of characters at the end after group=. If you are not a group member and they have land somewhere, you can use llGetLandOwnerAt over their group owned land to get the key. Hope this helps.
|
|
Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
|
02-11-2006 17:31
Doh. I guess it was a brain cramp, thanks, should have thought of that. Much appreciated! =Riz
|
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
02-11-2006 17:32
From: Rizado DaSilva Doh. I guess it was a brain cramp, thanks, should have thought of that.
=Riz No problem  .
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
02-12-2006 09:52
From: Cid Jacobs if(llSameGroup(llGetKey()) == llSameGroup(GroupKey))
I'm confused... what's this line supposed to do...?
|
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
02-12-2006 14:29
From: Lex Neva I'm confused... what's this line supposed to do...? llSameGroup will return TRUE if passed the key of the group itself. So if you get a TRUE for the llGetKey(), which you will always get, and a TRUE for the hardcoded key, then that means that the hardcoded group key is also the group key of the object. If you get a FALSE for the hardcoded key, then you will move into the other else statement, because TRUE != FALSE. Hope that helps make it a bit more clear.
|
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
02-12-2006 14:31
From: Cid Jacobs llSameGroup will return TRUE if passed the key of the group itself. So if you get a TRUE for the llGetKey(), which you will always get, and a TRUE for the hardcoded key, then that means that the hardcoded group key is also the group key of the object. If you get a FALSE for the hardcoded key, then you will move into the other else statement, because TRUE != FALSE. Hope that helps make it a bit more clear. To make it even more simple: llSameGroup can only return TRUE or FALSE, so you have to test both keys before hand and then compare the llSameGroup results.
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
02-12-2006 14:35
From: Cid Jacobs To make it even more simple: llSameGroup can only return TRUE or FALSE, so you have to test both keys before hand and then compare the llSameGroup results. That makes no sense to me. An object is always a member of the group it's set to. llSameGroup(llGetKey()) should *always* return true. llSameGroup(GroupKey) should be sufficient by it's lonesome, should it not?
|
|
Cid Jacobs
Theoretical Meteorologist
Join date: 18 Jul 2004
Posts: 4,304
|
02-12-2006 14:43
From: Jillian Callahan That makes no sense to me. An object is always a member of the group it's set to. llSameGroup(llGetKey()) should *always* return true. Yea, you are right. I seem to always do at least one redundancy per script. 
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
02-12-2006 15:19
From: Cid Jacobs Yea, you are right. I seem to always do at least one redundancy per script.  
|
|
Rizado DaSilva
Merchant
Join date: 12 May 2005
Posts: 30
|
02-13-2006 09:20
Ok, now you have *me* confused... The following would work, right? key group = "12345-12345-12345"; //nottarealkey if (llSameGroup(avKey_id) == llSameGroup(group)) { true_so_dothis; } else { false_so_dothis; } Which, should check the AVie's current set group and compare against the hard-coded key... =R
|
|
Sky Honey
Coder
Join date: 16 May 2005
Posts: 105
|
02-14-2006 04:50
From: Rizado DaSilva key group = "12345-12345-12345"; //nottarealkey if (llSameGroup(avKey_id) == llSameGroup(group)) { true_so_dothis; } else { false_so_dothis; } You're using == to compare two boolean values. If they're both FALSE then true_so_do_this is called.
|