Jump to content

Check if all attachments in a folder are attached


primerib1
 Share

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

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

Recommended Posts

2 hours ago, KT Kingsley said:
Quote
  • Get the list of shared folders in the avatar's inventory, with information about worn items : @getinvworn[:folder1/.../folderN]=<channel_number>

Implemented in v1.15

Makes the viewer automatically answer the list of folders contained into the folder named "#RLV" (if it exists), immediately on the chat channel number <channel_number> that the script can listen to. If folders are specified, it will give the list of sub-folders contained into the folder located at that path instead of the shared root (example : "@getinvworn:Restraints/Leather cuffs/Arms=2222"). Always use a non-zero integer. Remember that regular viewers do not answer anything at all so remove the listener after a timeout.

The answer is a comma-separated list of names, each one followed with a pipe ("|") and two digits. The current folder is put in first position (as opposed to @getinv which does not show the current folder, obviously), but without a name, only the pipe and the two digits.

Object : "@getinvworn:Restraints/Leather cuffs=2222"
Viewer : "|02,Arms|30,Legs|10"

Folders which names begin with a dot (".") will be ignored. The two digits are calculated as follows :

First digit : Proportion of items worn in the corresponding folder (including no-mod items). In this example, the "3" of "30" means "all the items in the "Arms" folder are currently worn, while the "1" of "10" means "no item in the Legs folder is currently worn, but there are items to wear".

Second digit : Proportion of items globally worn in all the folders contained inside the corresponding folder. In this example, the "2" of "02" means "some items are worn in some of the folders contained into "Leather cuffs".

The digits, comprised between 0 and 3 included, have the following meaning :

  • 0 : No item is present in that folder
  • 1 : Some items are present in that folder, but none of them is worn
  • 2 : Some items are present in that folder, and some of them are worn
  • 3 : Some items are present in that folder, and all of them are worn

That's a bit of a beast of an example to unpack, in summary, if you only care about attachments which exist directly in the specific folder you're interested in, check the 1-index character of the response, or the lesser of the 1-index and 2-index characters* if you're also interested in attachments in the sub-folders of the folder you're interested in.

An important caveat is that some RLV folder functions don't work "correctly" on inventory links. I'd do some tests if that's relevant to your application.

* actually thinking it through carefully, converting the 2-digits into a single digit for the whole folder is a bit involved:

listen(...)
{   if(2222==chan)
    {
        integer wornFolder = (integer)llGetSubString(text,1);
        integer wornRecursive = (integer)llGetSubString(text,2);
        integer wornWhole = wornFolder*wornRecursive;
        if(wornWhole)
        {   if(wornWhole==1)
            {   //wornWhole=1;
            }else if(wornWhole==9)
            {   wornWhole=3;
            }else
            {   wornWhole=2;
            }
        }else
        {   wornWhole = wornFolder+wornRecursive;
        }
        // wornWhole now represents 0: no items in the folder, 1: none worn, 2: some worn, 3: all worn
    }
}

if my logic cells work this morning.

Edited by Quistess Alpha
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

2 hours ago, Quistess Alpha said:

* actually thinking it through carefully, converting the 2-digits into a single digit for the whole folder is a bit involved:

Wait, isn't that what the first number is for?

The example looks like this:

Object : "@getinvworn:Restraints/Leather cuffs=2222"
Viewer : "|02,Arms|30,Legs|10"

So for the whole folder "Restraints/Leather cuffs", I only need to parse the first portion "|02" where the number "2" means "some worn" ?

Edited by primerib1
Link to comment
Share on other sites

1 hour ago, primerib1 said:

So for the whole folder "Restraints/Leather cuffs", I only need to parse the first portion "|02" where the number "2" means "some worn" ?

sort of, the 0 means there are no items directly in the folder "#RLV/Restraints/Leather Cuffs" the 2 means that in some of the sub folders, (specifically the 'arms' subfolder in this example) there are items that are worn, but there also exist items in some of the sub folders which are not worn. 

if everything in the folder (including children) is worn, you'd get 30, 03, or 33, if nothing is worn you might get 10, 01 or 11 (ETA: or 00);  any other combination implies there exist things in the folder or its children that are not worn. which possibility depends on the structure of the folder.

If reading the whole string helps:

|02 -> 0:There are no wearables contained in the folder directly, 2: but there are some wearables in child folders and some of them but not all are worn.

Arms|30 -> 3:There are wearables in the Arms subfolder and they are all worn; 0: there are no wearables in sub folders of the arms folder

Legs|10 -> 1:There are wearables in the Legs sub-folder and none of them are worn, 0: there are no wearables in sub folders of the Legs folder

Edited by Quistess Alpha
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

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