OsGetLinkInventoryNames

From OpenSimulator

(Difference between revisions)
Jump to: navigation, search
(Translated comments)
Line 4: Line 4:
 
|delay=0|function_syntax=osGetLinkInventoryNames(integer linkNumber, integer type)<br>
 
|delay=0|function_syntax=osGetLinkInventoryNames(integer linkNumber, integer type)<br>
 
|ossl_example=<source lang="lsl">
 
|ossl_example=<source lang="lsl">
// Beispiel für osGetLinkInventoryNames
+
// Example for osGetLinkInventoryNames
// In diesem Skript wird die Funktion osGetLinkInventoryNames verwendet,
+
// This script uses the osGetLinkInventoryNames function to return a list of inventory items of a specified type in a specified child prim
// um eine Liste von Gegenstandsnamen basierend auf dem angegebenen Typ (INVENTORY_ALL für alle Typen)
+
// aus dem Inventar der Unterprim mit der Nummer CHILD_PRIM_NUMBER abzurufen.
+
// Die erhaltenen Gegenstandsnamen werden dann im Besitzer-Chatfenster ausgegeben.
+
  
// Definiere die Nummer der Unterprim, die das Inventar enthält
+
// Define the child prim
 
integer CHILD_PRIM_NUMBER = 2;
 
integer CHILD_PRIM_NUMBER = 2;
// Definiere den Typ des Inventars, der abgerufen werden soll (INVENTORY_ALL für alle Typen)
+
// Define the inventory type
 
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 osGetLinkInventoryNames aus, um eine Liste von Inventarnamen abzurufen
+
         // Get the list of inventory items by name
 
         list inventoryNames = osGetLinkInventoryNames(CHILD_PRIM_NUMBER, INVENTORY_TYPE);
 
         list inventoryNames = osGetLinkInventoryNames(CHILD_PRIM_NUMBER, INVENTORY_TYPE);
  
         // Überprüfe, ob die Liste nicht leer ist
+
         // Check if the list contains items
 
         if (llGetListLength(inventoryNames) > 0)
 
         if (llGetListLength(inventoryNames) > 0)
 
         {
 
         {
             // Durchlaufe die Liste und zeige jeden Eintrag im Besitzer-Chatfenster an
+
             // Go through the list and output the names to owner chat
 
             integer numItems = llGetListLength(inventoryNames);
 
             integer numItems = llGetListLength(inventoryNames);
             string itemNames = "Inventar Gegenstände:\n";
+
             string itemNames = "Inventory items:\n";
 
             integer i;
 
             integer i;
 
             for (i = 0; i < numItems; ++i)
 
             for (i = 0; i < numItems; ++i)
Line 39: Line 36:
 
         else
 
         else
 
         {
 
         {
             // Wenn das Inventar leer ist, zeige eine entsprechende Nachricht im Chat an
+
             // If nothing is found indicate as such
             llOwnerSay("Das Inventar ist leer oder es wurden keine Gegenstände des angegebenen Typs gefunden.");
+
             llOwnerSay("The inventory of the child prim is empty or does not contains items of this inventory type");
 
         }
 
         }
 
     }
 
     }

Revision as of 21:22, 26 February 2024

osGetLinkInventoryNames(integer linkNumber, integer type)
Return a list of items names by type (or INVENTORY_ALL) located in a child prim inventory.
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 osGetLinkInventoryNames
// This script uses the osGetLinkInventoryNames function to return a list of inventory items of a specified type in a specified child prim
 
// Define the child prim
integer CHILD_PRIM_NUMBER = 2;
// Define the inventory type
integer INVENTORY_TYPE = INVENTORY_ALL;
 
// Event handler, that is executed on script start
default
{
    state_entry()
    {
        // Get the list of inventory items by name
        list inventoryNames = osGetLinkInventoryNames(CHILD_PRIM_NUMBER, INVENTORY_TYPE);
 
        // Check if the list contains items
        if (llGetListLength(inventoryNames) > 0)
        {
            // Go through the list and output the names to owner chat
            integer numItems = llGetListLength(inventoryNames);
            string itemNames = "Inventory items:\n";
            integer i;
            for (i = 0; i < numItems; ++i)
            {
                string itemName = llList2String(inventoryNames, i);
                itemNames += itemName + "\n";
            }
            llOwnerSay(itemNames);
        }
        else
        {
            // If nothing is found indicate as such
            llOwnerSay("The inventory of the child prim is empty or does not contains items of this inventory type");
        }
    }
}
Notes
This function was added in 0.9.3.0


Personal tools
General
About This Wiki