Difference between revisions of "LlSameGroup"

From Second Life Wiki
Jump to navigation Jump to search
m (fixe)
m (No script should assume there is only one detected agent at a time)
Line 13: Line 13:
|caveats
|caveats
|constants
|constants
|examples=<lsl>//Gives inventory object only to agents with the same active group
|examples=<lsl>// Gives inventory object only to agents with the same active group
default
default
{
{
     touch_start(integer total_number)
     touch_start(integer total_number)
     {
     {
         if(llSameGroup(llDetectedKey(0)))//same as llDetectedGroup(0) (with llDetectedGroup, detected does not need to be in the sim)
         integer i;
            llGiveInventory(llDetectedKey(0), llGetInventoryName(INVENTORY_OBJECT,0));
 
        else
        for (i = 0; i < total_number; i++)
            llSay(0, "Wrong active group!");
        {
            if (llSameGroup(llDetectedKey(i))) // same as llDetectedGroup(i) (with llDetectedGroup, detected does not need to be in the sim)
              llGiveInventory(llDetectedKey(i), llGetInventoryName(INVENTORY_OBJECT, 0));
          else
              llSay(0, "Wrong active group!");
        }
     }
     }
}</lsl>
}</lsl>

Revision as of 03:46, 17 June 2008

Summary

Function: integer llSameGroup( key agent );

Returns an integer boolean, that is TRUE if agent has the same active group, otherwise FALSE

• key agent must be in the same sim

Also returns TRUE if the object is deeded to the same active group as agent

Examples

<lsl>// Gives inventory object only to agents with the same active group default {

   touch_start(integer total_number)
   {
       integer i;
       for (i = 0; i < total_number; i++)
       {
           if (llSameGroup(llDetectedKey(i))) // same as llDetectedGroup(i) (with llDetectedGroup, detected does not need to be in the sim)
             llGiveInventory(llDetectedKey(i), llGetInventoryName(INVENTORY_OBJECT, 0));
          else
             llSay(0, "Wrong active group!");
       }
   }
}</lsl>

See Also

Functions

•  llDetectedGroup Used in conjunction with detection events

Deep Notes

Search JIRA for related Issues

Signature

function integer llSameGroup( key agent );