This command is potentially dangerous. For example, if you send a "rm" command, then Corrade will delete the current working directory. Please ensure that you test scripts on non system folders or expendable inventory items before running the scripts in production.

Inventory Manipulation using Path-Based Commands

3 August 2024

  • C12 - add the follow parameter.

8 January 2024

  • C12 - add the verify parameter.

6 October 2016

  • Release 9.133 - The command now can take a path instead of a name.

11 September 2016

  • Release 9.122 - added the ability to rename and name items using the mv action.

28 March 2015

  • Release 7.86 - added the actions cp (copy an item), mv (move an item), ln (create an item link).

25 March 2015

  • Release 7.83 - added.
inventory (Commands)
TypeCorrade progressive command
Commandinventory
DescriptionThe inventory commands allows an user to manipulate Corrade's inventory by using a set of commands comparable to UNIX commands for manipulating directory paths.
Permissionsinventory
Parametersgroup, password, action
Last ChangesRelease 9.133 - The command now can take a path instead of a name.

The inventory commands allows an user to manipulate Corrade's inventory by using a set of commands comparable to UNIX commands for manipulating directory paths. When Corrade is started, each group has its own unique current directory set to My Inventory, which can then be manipulated and altered separately by each group in part.

Command Required Parameters Required Corrade Permissions Example
inventory group, password, action inventory
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // show current directory.
            "command", "inventory",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "action", "cwd"
        ]
    )
);
Action Required Parameter Optional Parameter Description
ls path Lists the contents of the current folder with an optional path and follow links if follow is set to True.
follow
cwd follow List the current directory and optionally follow links if follow is set to True.
cd path Changes directory to the folder specified by the path.
mkdir name path Creates a directory specified by name at a given optional path - or, inside the current directory, if the path is not specified.
chmod permissions path Sets the permissions on the items in the current directory, or in a directory specified by path or an item in the path.
rm path Removes the folder or inventory item referred to by path to the trash folder.
verify The verify parameter must be set to True in case the command should act upon system folders.
cp source Copies an item specified by the source path to the target with an optional new name. The target can be either a folder or a path ending in a name.
target
name
mv source Moves an item specified by the source path to the target. The target has to be an inventory folder. If the name parameter is also specified, then the item will be renamed.
target
name
verify The verify parameter must be set to True in case the command should allow the source folder to be a system folder.
ln source Creates a link from the source path to the target folder with an optional new name. Note that the source must be the path to an item and that folders are not supported. The target can be either a folder or a path ending in a name.
target
name

Notes

  • For a discussion on how to specify paths and escaping path components please see the scripting considerations page.
  • Every group has a separate and private filesystem pointer that can be obtained by issuing the command with action set to cwd. The pointer describes where in the inventory folder tree the user finds itself and issuing commands will take the current working directory cwd as parameter when the path parameter is not provided. For instance, issuing cd /My Inventory/Objects will make the pointer reference the folder /My Inventory/Objects and any commands such as ls will list the contents of the /My Inventory/Objects folder. The pointer will be reset upon each Corrade restart.
  • The ls sub-parameter will make the command return a CVS list of the following fields:
    • name - the name of the inventory item,
    • item - the inventory UUID of the inventory item,
    • type - the inventory item type,
    • permissions - a permission string representing the permissions of the inventory item,
    • time - a string representing the last modification date of the inventory item.
  • The command always operates in the context of the SL inventory and will return and accept only inventory UUIDs. In case more data is required, such as, for example, the asset UUID for textures, sounds, etc, then a followup getinventorydata command can be used.

Querying and Setting Permissions

This command uses the Corrade permissions notation. As an example, let us enumerate a notecard called test and placed in the Notecards sub-folder of My Inventory:

llInstantMessage(CORRADE, 
    wasKeyValueEncode(
        [
            // show current directory.
            "command", "inventory",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "action", "ls",
            "path", wasURLEscape("/My Inventory/Notecards/test"),
            "callback", wasURLEscape(URL)
        ]
    )
);

the callback will receive a data key with the following CSV:

name, test, item, b815f8e4-0367-b361-9227-f1ab7e036eef, type, notecard, permissions, c--mvt------------c--mvtc--mvt

we can thus observe that the permissions for the test notecard are:

c--mvt------------c--mvtc--mvt

these permissions are similar to UNIX commands and are compatible with Corrade's chmod action of the inventory command. They describe all the permissions governing our test notecard.

To dissect these permissions, you can use the following guide:

  • split that string in segments of 6 characters: cdemvt, ——, ——, cdemvt, cdemvt.
  • each segment means, in order: base permissions, everyone permissions, group permissions, next owner permissions, owner permissions.
  • each character means, in order: c (copy), d (damage), e (export), m (modify), v (move), t (transfer).
    • if any of the previously mentioned characters are missing and have a dash (-) instead, that means that the permissions is missing.

Suppose that we wanted to change the permissions for the next owner and remove the modify permissions. We would then issue the following command:

llInstantMessage(CORRADE, 
    wasKeyValueEncode(
        [
            // show current directory.
            "command", "inventory",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "action", "chmod",
            "path", wasURLEscape("/My Inventory/Notecards/test"),
            "permissions", wasURLEscape("c--mvt------------c---vtc--mvt"),
            "callback", wasURLEscape(URL)
        ]
    )
);

The original permissions for the test notecard were:

c--mvt------------c--mvtc--mvt

and the new permissions are now:

c--mvt------------c---vtc--mvt

As you can see, the 4th segment which refers to the next owner permissions is missing the m component, meaning that it cannot be modified.


secondlife/scripted_agents/corrade/api/commands/inventory.txt · Last modified: 2024/08/03 14:30 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.