Group Detection - no touchy touchy
|
|
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
|
02-14-2007 18:22
Is there a way to check to see if an avatar has joined a particular group before allowing them to execute the Touch option in a script (touch_event).?
if group = MyGroupName then continue down the script; else give them option to join so they can touch the object.
thanks.
|
|
Kermitt Quirk
Registered User
Join date: 4 Sep 2004
Posts: 267
|
02-14-2007 18:37
The short answer is no, there just isn't any LSL functions to do what you're trying to do. The closest thing we have is llSameGroup which will tell you if the avatar who clicked belongs to the group that is set on the object containing the script (and the avatar has that group active). (Also note that setting the group that an object belongs to is not the same as deeding it to the group. The object does not have to be deeded for this function to work.) It may be possible to do it externally by using libSL but that would probably be a lot of work to implement and would require an additional custom client of some kind.
|
|
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
|
thx
02-14-2007 19:01
Thanks..I will go play with that and see if it does what I want it to do. We are basically trying to confirm that the avatar touching the object has paid to touch the object. We were thinking of doing this through charging them for joining the group and checking for group status. There are going to be many, many objects and once they have paid they are free to touch as many of those objects as they can. Not sure if there is a better way to do this.
thanks for your help
|
|
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
|
02-14-2007 20:12
remember (as far as I recall) that llSameGroup only detects the CURRENT group title worn by the user.. not their presence IN the group. So if you're not wearing the right title.. it will reject you (have this problem all the time with certain camping systems and tipjars)
_____________________
 ● Inworld Store: http://slurl.eclectic-randomness.com ● Website: http://www.eclectic-randomness.com ● Twitter: @WinterVentura
|
|
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
|
02-14-2007 21:21
Rather than using groups, you could have them pay an object, which stores their name or key in an external database. Then when you need to verify them, perform a lookup. (Take a look at llHTTPRequest.) A bit more complicated, requiring a web server, database knowledge, and ASP/PHP/JSP/Perl/similar knowledge, but gets around the group issue.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-15-2007 00:34
From: Jacques Groshomme Rather than using groups, you could have them pay an object, which stores their name or key in an external database. Then when you need to verify them, perform a lookup. (Take a look at llHTTPRequest.) A bit more complicated, requiring a web server, database knowledge, and ASP/PHP/JSP/Perl/similar knowledge, but gets around the group issue. You can do the same thing in world just using standard LSL objects and email. Not as resilliant admittedly but works.
|
|
Lex Neva
wears dorky glasses
Join date: 27 Nov 2004
Posts: 1,361
|
02-15-2007 09:35
In a touch event, llDetectedGroup(0) will be slightly more efficient than llSameGroup(llDetectedKey(0)), and it will produce the same exact return value.
|
|
Jacques Groshomme
Registered User
Join date: 16 Mar 2005
Posts: 355
|
02-15-2007 19:00
From: Newgate Ludd You can do the same thing in world just using standard LSL objects and email. Not as resilliant admittedly but works. At this point, I'd trust the availability of a web server over the availability of a sim/mail system where the server object is sitting. Plus, you can actually *write* to a database.  So yes, I agree. It works but not nearly as well. But it's also easier at times to work with one language rather than (at least) 2.
|
|
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
|
godaddy
02-18-2007 21:25
From: Jacques Groshomme Rather than using groups, you could have them pay an object, which stores their name or key in an external database. Then when you need to verify them, perform a lookup. (Take a look at llHTTPRequest.) A bit more complicated, requiring a web server, database knowledge, and ASP/PHP/JSP/Perl/similar knowledge, but gets around the group issue. I am familiar with mysql and db design/management. So are you saying I can have an object in Second Life run basic db commands to a database I have hosted by on IP provider like Godaddy.com or other?? That would solve my problems for sure!
|
|
Frax Dae
Registered User
Join date: 14 Dec 2006
Posts: 5
|
02-18-2007 23:53
From: Kermitt Quirk (Also note that setting the group that an object belongs to is not the same as deeding it to the group. The object does not have to be deeded for this function to work.) Uhm, so how do you "set" the group an object belongs to? The only way to do that I have been aware of so far is deeding it to a group.
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-19-2007 01:58
From: Frax Dae Uhm, so how do you "set" the group an object belongs to? The only way to do that I have been aware of so far is deeding it to a group. You can set an object to agroup by selecting a group tag for it. It is only deeded to teh group when you press "deed to group".
|
|
Damian McLeod
Wandoering Ronin
Join date: 12 Oct 2006
Posts: 3
|
Forgive the newbie, but...
02-19-2007 16:05
From: Nichiren Dinzeo Is there a way to check to see if an avatar has joined a particular group before allowing them to execute the Touch option in a script (touch_event).?
if group = MyGroupName then continue down the script; else give them option to join so they can touch the object.
thanks. Forgive the newbie at LSL, but since you can't check a group before they touch it and can only react to the touch, why not branch the execution based on whether they are or are not in the required group? If they are, the object records the touch or does whatever else is needed, if they are not in the group, have it tell them that they need to be in the group, and point them in the right direction to join the required group. Damian McLeod Ronin Labs CEO
|
|
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
|
02-20-2007 01:36
Damian's answer is correct, your script would just call a different function ro section of code in responce to who touches it. You cannot perform any group joining functions from within LSL. Best you can do is tell them they need to be a member of the group. default { touch_start(integer total_number) { key id = llDetectedKey(0); if ( llSameGroup(id) // check for sdame group { DoSomething(); } else { // if not llSay(0, "Group members only, sorry."); llSay(0, "If you are a group member, please \"wear your tags\" by making the group active.."); } }
|
|
Gaius Goodliffe
Dreamsmith
Join date: 15 Jan 2006
Posts: 116
|
02-20-2007 13:58
Do remember that in a touch event, you should be using llDetectedGroup, not llSameGroup. Also, be aware that if the object has no group set, and the user has no active group, llDetectedGroup/llSameGroup will return TRUE. However, you can detect that by using llSameGroup(NULL_KEY) to determine if your object has no group set (the LSL Wiki implies otherwise, but it is incorrect). Finally, note that touch events potentially return info on multiple touches (more likely during a busy/laggy event). If you're checking info on who touched you rather than not caring who touched you, you should never just use llDetectedXXX(0) as in the above code. Here's some revised code that takes all this into account, responding to any touch by the owner or members of the same group, even during busy times: default { touch_start(integer count) { integer i; for ( i = 0 ; i < count ; ++i ) { key who = llDetectedKey(i); if ( who == llGetOwner() || (llDetectedGroup(i) && ! llSameGroup(NULL_KEY)) ) { // do stuff } else { llSay(0, "Sorry, " + llDetectedName(i) + ", this object may only be used by group members. If you are a member of the group, switch your active group tag to it."); } } } } If you want to make it less spammy, consider llInstantMessage(who, "Sorry..."  but remember the time delay (I always send IMs using a link message to another script).
|
|
Nichiren Dinzeo
Registered User
Join date: 14 Feb 2007
Posts: 203
|
03-19-2007 15:54
Is it possible to not only detect the two groups? The object will belong to one group and the avatar will belong to another group. So the object should be accessable by both groups. The avatar group being a group I own. default { touch_start(integer count) { integer i; for ( i = 0 ; i < count ; ++i ) { key who = llDetectedKey(i); if ( who == llGetOwner() || (llDetectedGroup(i) && ! llSameGroup(NULL_KEY)) ) { // do stuff } else { llSay(0, "Sorry, " + llDetectedName(i) + ", this object may only be used by group members. If you are a member of the group, switch your active group tag to it."); } } } } If you want to make it less spammy, consider llInstantMessage(who, "Sorry..."  but remember the time delay (I always send IMs using a link message to another script).[/QUOTE]
|