Difference between revisions of "Group key finder"

From Second Life Wiki
Jump to navigation Jump to search
m (<lsl> tag to <source>)
 
(2 intermediate revisions by 2 users not shown)
Line 3: Line 3:
Place this script in a prim and touch it to find out the set group's key.
Place this script in a prim and touch it to find out the set group's key.


<lsl>//Emmas Seetan
<source lang="lsl2">
//21 September, 16:41
default
{
    state_entry()
    {
        llSetText("Touch to learn\nGroup Key", <1,1,1>, 1); //Like it says
    }
    touch_start(integer total_number)
    {
        list a = llGetObjectDetails(llGetKey(), [OBJECT_GROUP]);
        string b = llList2String(a,0);
        if (b == "00000000-0000-0000-0000-000000000000") //Black UUID, group key will fill this in
        {
            llWhisper(0, "Please set the Group for this object in EDIT under the GENERAL tab first."); //Set the group you  want
        }
        else
        {
            llWhisper(0, "This object's Group Key is: " + b); //Blank gets replaced by the group's UUID
        }
    }
}</lsl>
 
 
== Slightly Optimized Version ==
<lsl>
// Niles Argus [May 11, 2009]
default
default
{
{
     state_entry()
     state_entry()
     {
     {
         llSetText("Touch me to find my group's key...", <1,1,1>, 1.0);
        // white and opaque text
         llSetText("Touch to learn\nGroup Key", <1.0, 1.0, 1.0>, (float)TRUE);
     }
     }
     touch_start(integer total_number)
     touch_start(integer num_detected)
     {
     {
         key group = llList2Key(llGetObjectDetails(llGetKey(), [OBJECT_GROUP]),0);
         key thisPrim = llGetKey();
         string result = "This object is not set to a group.";
         if(group != NULL_KEY)
        list objectDetails = llGetObjectDetails(thisPrim, [OBJECT_GROUP]);
             result = "This object's group's key is " + (string)group;
      key objectGroup = llList2Key(objectDetails, 0);
         llWhisper(0, result);
         string output = "Please set the group for this object in EDIT under the GENERAL tab first.";
         if (objectGroup != NULL_KEY)
             output = "This object's group key is: '" + (string)objectGroup + "'.";
        // PUBLIC_CHANNEL has the integer value 0
         llWhisper(PUBLIC_CHANNEL, output);
     }
     }
}
}
</lsl>
</source>

Latest revision as of 21:30, 24 January 2015

The Group Key Finder

Place this script in a prim and touch it to find out the set group's key.

default
{
    state_entry()
    {
        // white and opaque text
        llSetText("Touch to learn\nGroup Key", <1.0, 1.0, 1.0>, (float)TRUE);
    }
 
    touch_start(integer num_detected)
    {
        key thisPrim = llGetKey();
 
        list objectDetails = llGetObjectDetails(thisPrim, [OBJECT_GROUP]);
      key objectGroup = llList2Key(objectDetails, 0);
 
        string output = "Please set the group for this object in EDIT under the GENERAL tab first.";
 
        if (objectGroup != NULL_KEY)
            output = "This object's group key is: '" + (string)objectGroup + "'.";
 
        // PUBLIC_CHANNEL has the integer value 0
        llWhisper(PUBLIC_CHANNEL, output);
    }
}