Difference between revisions of "User:Nyeomi Resident"

From Second Life Wiki
Jump to navigation Jump to search
m (added LSL tags and intra-wiki-links to page)
(This is a hack that won't stand up to multi-user touches.)
Line 1: Line 1:
Using [[llDetectedGroup]] & [[llSameGroup]]...
Using [[llDetectedGroup]] & [[llSameGroup]]...


[[llDetectedGroup]] & [[llSameGroup]] used seperately both return [[TRUE]] if the object is not set to a group (i.e. "(none)") and either the AV with the given key has no group active or the function is called with a [[NULL_KEY]]. However if [[llDetectedGroup]] is used with [[llSameGroup]] as shown in the examples below, the correct value will be returned regardless if the object is or is not set to a group.
[[llDetectedGroup]] & [[llSameGroup]] used separately both return [[TRUE]] if the object is not set to a group (i.e. "(none)") and either the AV with the given key has no group active or the function is called with a [[NULL_KEY]]. However if [[llDetectedGroup]] is used with [[llSameGroup]] as shown in the examples below, the correct value will be returned regardless if the object is or is not set to a group.


<lsl>
<lsl>
Line 22: Line 22:
     touch_end(integer num_detected)
     touch_end(integer num_detected)
     {
     {
        toggle          = !toggle;
         user            = llDetectedKey(0);
         user            = llDetectedKey(0);
         detectSameGroup = llDetectedGroup(llSameGroup(NULL_KEY));
         detectSameGroup = llDetectedGroup(llSameGroup(NULL_KEY));


         if (detectSameGroup && toggle)
         if (detectSameGroup)
         {
         {
             llRegionSayTo(user,PUBLIC_CHANNEL,
             toggle      = !toggle;
                "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
            if(toggle)
        }
            {
        else
                llRegionSayTo(user,PUBLIC_CHANNEL,
        {
                    "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
            llRegionSayTo(user,PUBLIC_CHANNEL,
            }
                "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
            else
            {
                llRegionSayTo(user,PUBLIC_CHANNEL,
                    "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
            }
         }
         }
     }
     }
</lsl>
</lsl>

Revision as of 21:55, 25 October 2013

Using llDetectedGroup & llSameGroup...

llDetectedGroup & llSameGroup used separately both return TRUE if the object is not set to a group (i.e. "(none)") and either the AV with the given key has no group active or the function is called with a NULL_KEY. However if llDetectedGroup is used with llSameGroup as shown in the examples below, the correct value will be returned regardless if the object is or is not set to a group.

<lsl>

  touch_end(integer num_detected)
  {
       if (llDetectedGroup(llSameGroup(NULL_KEY)))
       {
           llOwnerSay("Authorized Group");
       }
       else
       {
           llOwnerSay("UnAuthorized Group");
       }
  }

</lsl>

The Following is another example of a group only toggle...

<lsl>

   touch_end(integer num_detected)
   {
       user            = llDetectedKey(0);
       detectSameGroup = llDetectedGroup(llSameGroup(NULL_KEY));
       if (detectSameGroup)
       {
           toggle      = !toggle;
           if(toggle)
           {
               llRegionSayTo(user,PUBLIC_CHANNEL,
                   "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
           }
           else
           {
               llRegionSayTo(user,PUBLIC_CHANNEL,
                   "\n0=FALSE\n1=TRUE\nsameGroup=" + (string)detectSameGroup + "\ntoggle=" + (string)toggle);
           }
       }
   }

</lsl>