Group usage with llDetectedGroup
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-18-2007 22:15
hmm, not a single reference or example to be found.
I want get a touch event to work with owner or group not just everyone. This is the bit I am trying...
touch_start(integer total_number) { if(llDetectedKey(0) == llGetOwner()); // else if (llDetectedGroup(0) && llDetectedKey(0) != llGetOwner()); // else if(llSameGroup(llDetectedKey(0))) else if(llDetectedGroup(0) == llSameGroup()); // else if (llSameGroup() == llDetectedGroup(0)); open(); state opened; } It's gotta be simple. Help please.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Osgeld Barmy
Registered User
Join date: 22 Mar 2005
Posts: 3,336
|
08-18-2007 23:37
From: lsl wiki Returns TRUE if the agent/object associated with id has the same active group so if the av has the same group active as the object if (llSameGroup(llDetectedKey(0)) == TRUE)
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-19-2007 01:29
Thanks. I read that bit but still would not have worked out how to put that line together without and example. Thank you OB.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-19-2007 23:13
When another av touches the prim and they are not in the group, the touch still changes to state opened;. So when next it is clicked it goes in the closing direction although its already closed. And if I add the llSay(), how do I also stop going through to state opened;? Thanks. Might help others too. touch_start(integer total_number) { if(llDetectedKey(0) == llGetOwner()) open(); else if (llSameGroup(llDetectedKey(0)) == TRUE) open(); else if (llSameGroup(llDetectedKey(0)) == FALSE) llSay(0,"not allowed"  ; //stop here but stay in this state! state opened; }
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Squirrel Wood
Nuteater. Beware!
Join date: 14 Jun 2006
Posts: 471
|
08-19-2007 23:31
touch_start(integer total_number) { if ((llDetectedKey(0) == llGetOwner()) || (llSameGroup(llDetectedKey(0)) == TRUE)) { open(); state opened; } else { llSay(0,"not allowed"  ; } }
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-20-2007 01:25
Simpler still: if (llDetectedKey(0) == llGetOwner() || llDetectedGroup(0))
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-20-2007 01:32
Thanks for the help but I still have the click from non group member changing the state (it seems). The prim is in position A. Owner clicks and it moves to B. Other av not in group clicks and the prim does not move. Owner clicks again and prim moves to C not back to A where it should. Is it something else? other than the above posts which I should fix. im hopeless
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-20-2007 01:36
From: Kornscope Komachi Thanks for the help but I still have the click from non group member changing the state (it seems). The prim is in position A. Owner clicks and it moves to B. Other av not in group clicks and the prim does not move. Owner clicks again and prim moves to C not back to A where it should. Is it something else? other than the above posts which I should fix. im hopeless Can you post the whole touch() event for perusal?
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-20-2007 02:03
Heres the whole script. I have put it together by trial and error. Mostly error. The help is much appreciated. vector DIST = <0,0,0.4>; //set movement amount and direction float SLEEP = 0.3; //set time between movements float VOLUME = 0.8; // sound volume, 1.0 loudest, 0.0 to disable sound key SOUND_OPEN = "378b553c-d511-aab3-d220-c239a6d15ad3"; key SOUND_CLOSE = "8ae0e71f-6763-067f-073b-b299d687bc98"; vector oPos; vector cPos;
open() { llTriggerSound(SOUND_OPEN, VOLUME); cPos = llGetPos(); llSetPos(llGetLocalPos() + DIST); llSleep(SLEEP); llSetPos(llGetLocalPos() + DIST); llSleep(SLEEP); llSetPos(llGetLocalPos() + DIST); } close() { llTriggerSound(SOUND_CLOSE, VOLUME); oPos = llGetPos(); llSetPos(llGetLocalPos() - DIST); llSleep(SLEEP); llSetPos(llGetLocalPos() - DIST); llSleep(SLEEP); llSetPos(llGetLocalPos() - DIST); } default { state_entry() { cPos = llGetPos(); // remember where we're supposed to be closed state closed; } on_rez(integer start_param) { llResetScript(); }
moving_end() { // done moving me around, store new position cPos = llGetPos(); llResetScript(); } } state closed { state_entry(){ cPos = llGetPos(); } touch_start(integer total_number) {
if ((llDetectedKey(0) == llGetOwner()) || (llSameGroup(llDetectedKey(0)) == TRUE)) { open(); state opened; } else { llSay(0,"not allowed"); } } link_message(integer sender, integer num, string message, key id) { if(message == "Win1Open") open(); state opened; } }
state opened { state_entry(){ oPos = llGetPos(); } touch_start(integer total_number) { //if(llDetectedKey(0) != llGetOwner() && llDetectedGroup(0) == TRUE) if(llDetectedKey(0) == llGetOwner()) close(); else if (llSameGroup(llDetectedKey(0)) == TRUE)// allow group close(); state closed; } link_message(integer sender, integer num, string message, key id) { if(message == "Win1Close") close(); state closed; } }
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-20-2007 02:28
I think it works now. I saw the mess after i posted. Thanks for your efforts.
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|
|
Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
|
08-20-2007 03:04
Well... as I put the effort into it, here 'tis:
|
|
Kornscope Komachi
Transitional human
Join date: 30 Aug 2006
Posts: 1,041
|
08-20-2007 05:04
Thank you very much Jillian. Appreciated. (see sig)
_____________________
SCOPE Homes, Bangu -----------------------------------------------------------------
|