OsGetInventoryNames

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
m (Note about order)
 
(2 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
|threat_level=ignored
 
|threat_level=ignored
 
|permissions=true
 
|permissions=true
|delay=0|function_syntax=osGetInventoryNames(integer type)<br>
+
|delay=0|function_syntax=list osGetInventoryNames(integer type)<br>
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
// Beispiel für osGetInventoryNames
+
// Example for osGetInventoryNames
// In diesem Skript wird die Funktion osGetInventoryNames verwendet,
+
// This script uses the function osGetInventoryNames to return a list of inventory items by name
// um eine Liste von Inventarnamen basierend auf dem angegebenen Typ (INVENTORY_ALL) aus dem Primärinventar abzurufen.
+
// based on the inventory type (INVENTORY_ALL)
// Die erhaltenen Inventarnamen werden dann im Besitzer-Chatfenster ausgegeben.
+
// The found item names are output to owner chat
  
// Definiere einen Konstanten Wert für den Typ des Inventars
+
// Define the inventory type constant
 
integer INVENTORY_TYPE = INVENTORY_ALL;
 
integer INVENTORY_TYPE = INVENTORY_ALL;
  
// Event handler, der aufgerufen wird, wenn das Skript startet
+
// Event handler, that is executed on script start
 
default
 
default
 
{
 
{
 
     state_entry()
 
     state_entry()
 
     {
 
     {
         // Führe die Funktion osGetInventoryNames aus, um eine Liste von Inventarnamen zu erhalten
+
         // Use osGetInventoryNames to fetch the list of inventory items by name
 
         list inventoryList = osGetInventoryNames(INVENTORY_TYPE);
 
         list inventoryList = osGetInventoryNames(INVENTORY_TYPE);
  
         // Überprüfe, ob die Liste nicht leer ist
+
         // Check if the list is empty
 
         if (llGetListLength(inventoryList) > 0)
 
         if (llGetListLength(inventoryList) > 0)
 
         {
 
         {
             // Durchlaufe die Liste und zeige jeden Eintrag im Chat an
+
             // Go through the list and output each item to chat
 
             integer numItems = llGetListLength(inventoryList);
 
             integer numItems = llGetListLength(inventoryList);
             string itemNames = "Inventar Gegenstände:\n";
+
             string itemNames = "Inventory item(s):\n";
 
             integer i;
 
             integer i;
 
             for (i = 0; i < numItems; ++i)
 
             for (i = 0; i < numItems; ++i)
Line 36: Line 36:
 
         else
 
         else
 
         {
 
         {
             // Wenn das Inventar leer ist, zeige eine entsprechende Nachricht im Chat an
+
             // If the list is empty give indication as such
             llOwnerSay("Das Inventar ist leer.");
+
             llOwnerSay("Inventory is empty.");
 
         }
 
         }
 
     }
 
     }
Line 44: Line 44:
 
|description=
 
|description=
 
Return a list of items names by type (or INVENTORY_ALL) located in the prim inventory.
 
Return a list of items names by type (or INVENTORY_ALL) located in the prim inventory.
 +
List ordering is arbitrary. Successive calls may return different orders.
 
|additional_info=This function was added in 0.9.3.0
 
|additional_info=This function was added in 0.9.3.0
 
}}
 
}}

Latest revision as of 04:56, 29 March 2024

list osGetInventoryNames(integer type)
Return a list of items names by type (or INVENTORY_ALL) located in the prim inventory.

List ordering is arbitrary. Successive calls may return different orders.

Threat Level This function does not do a threat level check
Permissions Use of this function is always allowed by default
Extra Delay 0 seconds
Example(s)
// Example for osGetInventoryNames
// This script uses the function osGetInventoryNames to return a list of inventory items by name
// based on the inventory type (INVENTORY_ALL)
// The found item names are output to owner chat
 
// Define the inventory type constant
integer INVENTORY_TYPE = INVENTORY_ALL;
 
// Event handler, that is executed on script start
default
{
    state_entry()
    {
        // Use osGetInventoryNames to fetch the list of inventory items by name
        list inventoryList = osGetInventoryNames(INVENTORY_TYPE);
 
        // Check if the list is empty
        if (llGetListLength(inventoryList) > 0)
        {
            // Go through the list and output each item to chat
            integer numItems = llGetListLength(inventoryList);
            string itemNames = "Inventory item(s):\n";
            integer i;
            for (i = 0; i < numItems; ++i)
            {
                string itemName = llList2String(inventoryList, i);
                itemNames += itemName + "\n";
            }
            llOwnerSay(itemNames);
        }
        else
        {
            // If the list is empty give indication as such
            llOwnerSay("Inventory is empty.");
        }
    }
}
Notes
This function was added in 0.9.3.0


Personal tools
General
About This Wiki