Group Use Only?
|
Lynne Latte
Registered User
Join date: 3 Dec 2007
Posts: 21
|
01-06-2010 08:49
Hi, I'm a newb with scripts but wanted to setup an additional dance machine that is only usable by my staff members. I found this open source dance machine: http://wiki.secondlife.com/wiki/User:Kephra_Nurmi/lsDancemachine but before i get too far into learning how to set it up i'd like to confirm that i can achieve my ultimate project goal. Is it possible to add a script to such a set up to check for membership in a specific group before permitting the avatar to use the object containing the scripts? I've searched quite a bit in the lslwiki, here, and with Google but i suspect i'm not using the correct search terms to find an example of this type of script. Please point me in the right direction or suggest some more effective search terms. Thanks in advance! lynne latte
|
Dora Gustafson
Registered User
Join date: 13 Mar 2007
Posts: 779
|
01-06-2010 09:07
The obvious function to use is this one: http://lslwiki.net/lslwiki/wakka.php?wakka=llSameGroupIt can be used to test if an Av sitting/dancing/touching etc. is in the same group as the one the object is 'set to'
_____________________
From Studio Dora
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
01-06-2010 09:25
Note that the user has to be wearing the group tag. No LSL function can check to see whether someone is a member of the group but not wearing the tag.
|
Lynne Latte
Registered User
Join date: 3 Dec 2007
Posts: 21
|
01-06-2010 11:03
Cool, "llSameGroup" did the trick.
I was sure i was using the wrong search terms.
Thank you both.
lynne
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
01-06-2010 11:13
Next time, rather than trying to search, look at the categories and see if you can find a category that might match. Try a few of them. I think that generally works better than trying to search.
|
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
|
01-06-2010 12:26
as a trick, you can use same group to add av's to a list, which can be checked for membership even if they aren't wearing group tags at a later time. a quickie concept: list vLstMbr;
default{ touch_end( integer vIntTouchs ){ key vKeyAv = llDetectedKey( 0 ){ integer vIdxFnd = ~llListFindList( vLStMbr, (list)vKeyAv ); if (!vIdxFnd && llSameGroup( vKeyAv )){ vLstMbr += (list)vKeyAv; vIdxFnd = 1; } if (vIdxFnd){ //-- this av is allowed } } }
once they are detected once with tags they don't have to be after. no method for detecting booted members, or removing them, but those could be added.
_____________________
| | . "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... | - 
|
Lynne Latte
Registered User
Join date: 3 Dec 2007
Posts: 21
|
01-07-2010 08:24
From: Void Singer as a trick, you can use same group to add av's to a list, which can be checked for membership even if they aren't wearing group tags at a later time. a quickie concept: list vLstMbr;
default{ touch_end( integer vIntTouchs ){ key vKeyAv = llDetectedKey( 0 ){ integer vIdxFnd = ~llListFindList( vLStMbr, (list)vKeyAv ); if (!vIdxFnd && llSameGroup( vKeyAv )){ vLstMbr += (list)vKeyAv; vIdxFnd = 1; } if (vIdxFnd){ //-- this av is allowed } } }
once they are detected once with tags they don't have to be after. no method for detecting booted members, or removing them, but those could be added. That is a cool trick. =)
|
ElQ Homewood
Sleeps Professionally
Join date: 25 Apr 2007
Posts: 280
|
01-07-2010 09:47
lol damn void yer givin away my cool stuff now! Actually, I've been using http calls to check my web group membership. same deal, only with an llHTTPRequest. 
|
Lear Cale
wordy bugger
Join date: 22 Aug 2007
Posts: 3,569
|
01-07-2010 10:52
From: Void Singer as a trick, you can use same group to add av's to a list, which can be checked for membership even if they aren't wearing group tags at a later time. a quickie concept: list vLstMbr;
default{ touch_end( integer vIntTouchs ){ key vKeyAv = llDetectedKey( 0 ){ integer vIdxFnd = ~llListFindList( vLStMbr, (list)vKeyAv ); if (!vIdxFnd && llSameGroup( vKeyAv )){ vLstMbr += (list)vKeyAv; vIdxFnd = 1; } if (vIdxFnd){ //-- this av is allowed } } }
once they are detected once with tags they don't have to be after. no method for detecting booted members, or removing them, but those could be added. Yup, good one. If you want to reduce memory consumption, use llGetSubString to use the last 8 characters of the key and convert it to an integer. Also, this code will eventually run out of memory if the group is very large and lots of avatars use the object. If that's a concern, choose a maximum list length. Whenever adding a new member and the list is at its max length, remove the first list element (the oldest one). To avoide deleting frequent users, whenever a user is found on the list, delete them and add them to the end of the list.
|