Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

checking for Group membership

Random Torok
Registered User
Join date: 19 Mar 2007
Posts: 33
10-27-2007 22:56
Hey everyone;

I've got this opensource camping script that I want to modify to check for a specific active group. The script works well as it is now, I just want to make sure that only members make use of the camping device. Can someone show me how to modify this script?


// Begin Code //
integer campmoney = 0;
integer campadd = 1;
integer camptime = 60;
string reciever;
string sittext1 = "sit here for free money ,\nL$";
string sittext2 = " every 1 minutes";

string camptext = "Paying L$10/10min. ";
string sittext;
integer currenttime = 0;
//
default
{
state_entry()
{
sittext = sittext1 +(string)campadd+ sittext2 ;
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );
llSetText(sittext,<0,1,0>,1);
llSitTarget(<0.4, 0, 0.6>, ZERO_ROTATION);
}

on_rez(integer start_param)
{
llResetScript();
}

changed(integer change)
{
if (change & CHANGED_LINK)
{
if (llAvatarOnSitTarget() != NULL_KEY)
{
reciever = llAvatarOnSitTarget();
llSetText(camptext+(string)campmoney,<0,1,0>,1);
llSetTimerEvent(camptime);
}
else
{
llGiveMoney(reciever,campmoney);
reciever="";
campmoney=0;
llSetText(sittext,<0,1,0>,1);
llSetTimerEvent(100000000);
}
}
}
timer()
{
campmoney = campmoney+campadd;
llSetText(camptext + llKey2Name(reciever) + " has earned $" + (string)campmoney + "L so far." ,<0,1,0>,1);
if (llAvatarOnSitTarget() != NULL_KEY)
{
}
else
{
reciever="";
campmoney=0;
llSetText(sittext,<0,1,0>,1);
}
currenttime++;
llOwnerSay((string)currenttime);
if(currenttime == 10)
{
llUnSit(llAvatarOnSitTarget()); // unsit him
currenttime = 0;
}
}

run_time_permissions(integer perms)
{
if(perms & PERMISSION_DEBIT)
{
llSetText(sittext,<0,1,0>,1);
}
else
{//Permissions was denied.
llSetText("OFFLINE",<1,0,0>,1);
llRequestPermissions(llGetOwner(),PERMISSION_DEBIT );
}
}
}

//End Code //
Lyn Mimistrobell
(waiting)
Join date: 11 Jan 2007
Posts: 179
10-28-2007 02:36
After getting the AV's key ( reciever = llAvatarOnSitTarget(); ), check llSameGroup(reciever).

http://rpgstats.com/wiki/index.php?title=LlSameGroup
Deanna Trollop
BZ Enterprises
Join date: 30 Jan 2006
Posts: 671
10-28-2007 08:14
And note, this requires the camper to wear the tag of the group at the time, as this is all that LSL can check for, group-wise.
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
10-29-2007 00:31
To further clarify things:

You cannot check if a specific group is active.

Scripts can only check if the interacting individual is in the *same* group as the object with the script in it.
Zena Tiki
Registered User
Join date: 16 Nov 2006
Posts: 37
11-03-2007 18:49
Would it be possible to twist this a little, marry it to a visiter tracker and only log those visitors who are NOT group members?
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
11-03-2007 20:57
From: Zena Tiki
Would it be possible to twist this a little, marry it to a visiter tracker and only log those visitors who are NOT group members?

yup, but again, it'll still count them if their active tag isn't the same as the object

CODE

sensor( integer vIntSensed ){
do{
--vIntSensed;
if (!llDetectedGroup(vIntSensed)){
//-- logging code
}
}while (vIntSensed);
}
_____________________
|
| . "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...
| -