Jump to content

Group touch transparent on/off - help


Todd Sivith
 Share

You are about to reply to a thread that has been inactive for 751 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I'm having a brain fart on this one.... I'm sure it's just obvious, but I'm tired and just can't see where I made the mistake.  I'm back to SL after about a 10 year hiatus, and trying to pick up the scripting and such again with builds. Help please.  

Trying to make a simple check for group > if in group allow touch to turn object transparent on/off, if not in group doesn't allow touch.

 

key kGroup = llList2Key(llGetObjectDetails(llGetKey(),[OBJECT_GROUP]),0);

default 

    touch_start(integer total_number)
    {  
        llSetAlpha(0.0, ALL_SIDES); 
        state texture;
    }
    if ( ( kGroup != NULL_KEY) && (llSameGroup(llDetectedKey(0)) )
    {
        Dialog(llDetectedKey(0), MENU1);
    } 
}
state texture

    touch_start(integer total_number)
    { 
        llSetAlpha(1.0, ALL_SIDES);
        state default;
    }
    if ( ( kGroup != NULL_KEY) && (llSameGroup(llDetectedKey(0)) )
    {
        Dialog(llDetectedKey(0), MENU1);
    } 
}

Edited by Todd Sivith
additional info
Link to comment
Share on other sites

I'm assuming that there is more to the script somewhere, like your user-defined function, Dialog() and whatever code you need to activate a comm channel for it.  Leaving that to the side, your problem with the group filter is that the commands for making the object transparent or opaque are outside the test.  You want something like:

key kGroup;

default 
{ 
     state_entry()
     {
          kGroup = llList2Key(llGetObjectDetails(llGetKey(),[OBJECT_GROUP]),0); 
     }

     touch_start(integer total_number)
     {  
         if ( ( kGroup != NULL_KEY) && (llSameGroup(llDetectedKey(0)) )
         {
              llSetAlpha(0.0, ALL_SIDES); 
              Dialog(llDetectedKey(0), MENU1);
              state texture;
         }
     }
}

state texture
{ 
    touch_start(integer total_number)
    { 
         if ( ( kGroup != NULL_KEY) && (llSameGroup(llDetectedKey(0)) )
         {
             llSetAlpha(1.0, ALL_SIDES);
             Dialog(llDetectedKey(0), MENU1);
             state default;
         }
     } 
}

That won't take care of whatever your Dialog function is supposed to do, but it will make your transparency function depend on whether the toucher is a group member. One of the other unresolved questions you might ask yourself is what's going to happen if a group member makes the object transparent and then walks away.  

Edit:  Incidentally, unless you really need it as a facepalm reminder, it's not really necessary to test if (kGroup != NULL_KEY) .  After all, if kGroup == NULL_KEY, then nobody can trigger the transparency change. It's immediately obvious when you set the object up and nothing happens. 😉

Edited by Rolig Loon
  • Like 1
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 751 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...