LlGiveInventory All Test

From Second Life Wiki
Jump to navigation Jump to search

[LLInventoryAllTest]

[VERSION] 0.1

[LENGTH] 00:10

[TESTERS] 1

[OVERVIEW] This test has been designed to test the LSL function, llGetInventoryNumber with the flag INVENTORY_ALL. This should return the total number of items in the object (including the script) followed by a list of their names.

[SETUP] Tester must be in an area where building and scripting are enabled.

[*]

[INV] INVENTORY_ALL

[NOTE] INVENTORY_ALL_INVENTORYLIST

[0010] Open the object named 'INVENTORY_ALL' that just rezzed, and verify its contents against the list in the notecard you were just given.

[0020] Compare the output from the INVENTORY_ALL object in your chat history against the results from the previous step.

[0030] Right-click on the ground and select "Create" from the Pie menu and Rez a cube

[0040] Right-click on the new cube and Select "Edit", Rename the cube to a name with the max amount of characters, 64 is the current longest length

[0050] Close the edit window, Right-click on the cube and Select "Take"

[0060] Open you Inventory and Locate the cube you just took

[0070] Right Click and "Edit" the "INVENTORY_ALL" prim, Click "More >>" if necessary and Select the content tab, and drag the cube you created from your inventory to the contents of this prim

[0080] Edit or Replace the Script with the Following Script

[SCRIPT] Inventoryalltouchscript

[0090] Saving any changes and Closing the Script and Edit windows.

[0100] Touch the Prim and Verify that the Object List chatted matches that in the notecard you recieved earlier but also includes the cube with the long name, and the long name is displayed in full.

[0110] Right Click and "Edit" the "INVENTORY_ALL" prim, Click "More >>" if necessary and Select the content tab

[0120] Delete all the objects from the folder, leaving only the Script and Close the edit window

[0130] Touch the Prim and Verify that only one item is chatted and that is the name of the Script.

[0140] Clean up your workarea

[END]


[Inventoryallscript]

default
{
    state_entry()
    {

        integer i;
        integer max = llGetInventoryNumber(INVENTORY_ALL);
        llSay(0, "There are " + (string)max + " items in the inventory of this object.");
        for (i=0;i<max;++i)
        {

            llSay(0,llGetInventoryName(INVENTORY_ALL,i));

        }

    }

}


[Inventoryalltouchscript]

default
{
    touch_start(integer total_number)
    {

        integer i;
        integer max = llGetInventoryNumber(INVENTORY_ALL);
        llSay(0, "There are " + (string)max + " items in the inventory of this object.");
        for (i=0;i<max;++i)
        {
            
        llSay(0,llGetInventoryName(INVENTORY_ALL,i));
        
        }

    }

}