Jump to content

Key to name for key of group?


animats
 Share

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

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

Recommended Posts

The new llKey2Name works for avatar keys, but, it turns out, not for group keys. llGetParcelDetails, if asked for the owner of a parcel, returns a key which may be either an avatar key or a group key. How is that turned into a string name?

Link to comment
Share on other sites

list agent_keys;
list agent_names;
list groups;

integer x;

scan(){
    agent_keys = [];
    agent_names = [];
    agent_keys = llGetAgentList(AGENT_LIST_PARCEL,[]);
    integer i = 0;
    integer s = llGetListLength(agent_keys);
    for(;i<s;++i){
        agent_names += llKey2Name(llList2Key(agent_keys,i));
    }
    if(agent_keys == []){
        agent_names = ["No agent found."];
    }
}
current_group(key id){
    key aid = llList2Key(llGetAttachedList(id),0);
    key gk = llList2Key(llGetObjectDetails(aid,[OBJECT_GROUP]),0);
    llHTTPRequest("http://world.secondlife.com/group/" + (string)gk, [], "");
}
default
{
    state_entry(){
    }
    http_response(key rid, integer status, list metadata, string body){
        
        list args = llParseString2List(body, ["title"], []);
        string groupName = llList2String(llParseString2List(llList2String(args, 1), [">", "<", "/"], []), 0);
        groups += groupName;
        llSay(0,llList2String(agent_names,x)+"-"+groupName);
    }
    touch_start(integer ts){
        scan();
        integer s = llGetListLength(agent_keys);
        for(x=0;x<s;++x){
          current_group(llList2Key(agent_keys,x));
          llSleep(.1);
        }
    }
}

Heres a good bit of code I use for accomplishing this goal.

Link to comment
Share on other sites

On 07/07/2018 at 7:31 AM, animats said:

The new llKey2Name works for avatar keys, but, it turns out, not for group keys. llGetParcelDetails, if asked for the owner of a parcel, returns a key which may be either an avatar key or a group key. How is that turned into a string name?

For group keys of avatars who are present in the sim/region , you should use llgetObjectDetails with the key of avatar and the parameter OBJECT_GROUP_TAG

For instance:

// Script : waits the user touching the object and displays the name of avatars in the parcel and thei group tag


// User Function : cuurent_group : displays to the local chat ( private for the owner ) 
// the name of the avatar with the key [id] , and the name of his actual group
current_group(key id)
{
    llOwnerSay(llList2CSV(llGetObjectDetails(id, [OBJECT_NAME, OBJECT_GROUP_TAG] )));
}
    

default
{

    touch_end(integer ts){
        key id;
        integer x;
        list agent_keys = llGetAgentList(AGENT_LIST_PARCEL,[]);
        integer s = llGetListLength(agent_keys);
        llOwnerSay(llList2CSV( ["AVATAR_NAME", "GROUP_TAG"] ));
        for(x=0;x<s;++x){
          current_group(llList2Key(agent_keys,x));
        }
    }
}

 

The script is smaller , takes less memory and doesn t flood the site world.secondlife.com

Of course , some avatars can have no group tags selected : in this cas , only his name is displayed , and the group_tag name is blank

The avatars must be present in the region when  the script is running - 

( the value of "object_group_tag is returned by the simulator of the region  , not by the assets databases of avatars )

Edited by Miranda Umino
Link to comment
Share on other sites

4 minutes ago, Miranda Umino said:

For group keys of avatars who are present in the sim/region , you should use llgetObjectDetails with the key of avatar and the parameter OBJECT_GROUP_TAG

For instance:


// Script : waits the user touching the object and displays the name of avatars in the parcel and thei group tag


// User Function : cuurent_group : displays to the local chat ( private for the owner ) 
// the name of the avatar with the key [id] , and the name of his actual group
current_group(key id)
{
    llOwnerSay(llList2CSV(llGetObjectDetails(id, [OBJECT_NAME, OBJECT_GROUP_TAG] )));
}
    

default
{

    touch_end(integer ts){
        key id;
        integer x;
        list agent_keys = llGetAgentList(AGENT_LIST_PARCEL,[]);
        integer s = llGetListLength(agent_keys);
        llOwnerSay(llList2CSV( ["AVATAR_NAME", "GROUP_TAG"] ));
        for(x=0;x<s;++x){
          current_group(llList2Key(agent_keys,x));
        }
    }
}

 

The script is smaller , takes less memory and doesn t flood the site world.secondlife.com

That is not the same thing. The group tag is not necessarily the same as the group name. For example, the 7 Seas Social Chat - that is the name of the group. Group tags are "7Seas Fishaholic", "7Seas Hall of Famer", "7 Seas Fishwrangler", "7Seas Fishmonger"

  • Like 1
Link to comment
Share on other sites

You are right . It s not the same thing .

 

Nevertheless , maybe the group tag name used is more  iseful for the OP than the group name  

For instance ,

inside clubs : if you want to detect who has activated his "manager" tag in a club , and his "host" tag in a club . ( and they are in the same group)

inside shops : who has activated his simple customer tag name , and who has activated his prmium customer tag name ( and they are in the same group)

inside Rp sims : who gas activated his thief tag name , and who has activated his policeman tag name  a,d ho is "simple vistor" ( and they are in the same group)

 

As the OP has not been accurate in his request , i have answered this point

There are few reasons to use group name  ( to test a group , its better to test the key , and not the name )

Edited by Miranda Umino
  • Like 1
Link to comment
Share on other sites

2 minutes ago, Miranda Umino said:

You are right . Ut s not the same thing .

 

Nevertheless , maybe the group tag name used is more  iseful for the OP than the group name  

For instance ,

inside clubs : if you want to detect who has activated his "manager" tag in a club , and his "host" tag in a club . ( and they are in the same group)

inside shops : who has activated his simple customer tag name , and who has activated his prmium customer tag name ( and they are in the same group)

inside Rp sims : who gas activated his thief tag name , and who has activated his policeman tag name  a,d ho is "simple vistor" ( and they are in the same group)

 

Sure, then with that, assuming it's being checked with something under the same group, i would first check with llSameGroup, and then, if it is the same group, check for the tag with llGetObjectDetails, otherwise, just checking for the tag string to match, it could be cheated by creating the same tag with another group

Edited by Ruthven Willenov
Link to comment
Share on other sites

9 minutes ago, Ruthven Willenov said:

Sure, then with that, assuming it's being checked with something under the same group, i would first check with llSameGroup, and then, if it is the same group, check for the tag with llGetObjectDetails, otherwise, just checking for the tag string to match, it could be cheated by creating the same tag with another group

And so ? Cheating the group name is possible too . I have done it several times

Only the group key can t be cheated

Edited by Miranda Umino
Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2105 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...