LlGetInventoryNumber/de

From Second Life Wiki
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Beschreibung

Funktion: integer llGetInventoryNumber( integer type );

ist die Nummer des Gegenstands des angeforderten Typs type im Inventar des Prims.

• integer type INVENTORY_* flag

Flag Inventartyp
INVENTORY_NONE -1 Gegenstand existiert nicht.
INVENTORY_ALL Jeder Inventartyp.
INVENTORY_TEXTURE 0 Textur(en)
INVENTORY_SOUND 1 Geräusch(en)
INVENTORY_LANDMARK 3 Landmarke(en)
INVENTORY_CLOTHING 5 Kleidung(en)
Flag Inventartyp
INVENTORY_OBJECT 6 Objekt(en)
INVENTORY_NOTECARD 7 Notizkarte(en)
INVENTORY_SCRIPT 10 Script(en)
INVENTORY_BODYPART 13 Körperteil(en)
INVENTORY_ANIMATION 20 Animation(en)
INVENTORY_GESTURE 21 Geste(en)

Beispiele

<lsl>// Item Counter // By Apollia Pirandello // 9/19/2007 // // Public domain. Free to use and/or modify for any purpose, // including commercial purposes. // // Once you drop this script in any prim, it will immediately // tell you in an OwnerSay how many items are in that prim, // minus 1, so the script itself isn't counted. // // It will also do that whenever the prim is touched. //**********SCRIPT BEGINS BELOW**********

//****VARIABLE

integer items_contained;

//****END OF VARIABLE SECTION //****FUNCTIONS****

CountItems() {

 items_contained = llGetInventoryNumber( INVENTORY_ALL );
 --items_contained;

}

SayCount() {

 llOwnerSay( "This prim contains " + (string)items_contained + " items." );

}

//****END OF FUNCTIONS**** //****DEFAULT STATE****

default {

 state_entry()
 {
   CountItems();
   SayCount();
 }
 touch_start(integer total_number)
 {
   CountItems();
   SayCount();
 }  

}</lsl> <lsl>objects = llGetInventoryNumber(INVENTORY_OBJECT);</lsl> <lsl>// Inventory Statistic By Zep Palen. // Here is another use of llGetInventoryNumber to show a statistic in a hovertext // For this script to work you must add a showlist and an excludelist to the Description of the item this script is in. // The description field must be filled like follows: [showlist];[Excludelist] // Example: 0,1,3,5,6,7,10,13,20,21;3,7,10 // in the example all types are shown, but only types 3,7 and 10 are counted as total. You can see in the 2 lists below which number means which type // ----------------- // This script is free to use and modify as you wish - Zep Palen // --------------------------

list inv_types = [0, 1, 3, 5, 6, 7, 10, 13, 20, 21]; list inv_names = ["Textures", "Sounds", "Landmarks", "Clothings", "Objects", "Notecards", "Scripts", "Bodyparts", "Animations", "Gestures"];

processCountInventory() {

   list objDesc = llParseString2List(llGetObjectDesc(), [";"], []);
   list showList = llParseString2List(llList2String(objDesc, 0), [","], []);
   list excludeFromCount = llParseString2List(llList2String(objDesc, 1), [","], []);
           
   string counted = "ITEM COUNTER";
   integer i = ~llGetListLength(showList);
   while (++i)
   {
       integer showItem = (integer)llList2String(showList, i);
       integer sIndex = llListFindList(inv_types, [showItem]);
       if (~sIndex)
           counted += "\n" + llList2String(inv_names, sIndex) + ": " + (string)llGetInventoryNumber(showItem);
   }
   integer totalCount = llGetInventoryNumber(INVENTORY_ALL);
   for (i = ~llGetListLength(excludeFromCount); ++i;)
   {
       integer exclItem = (integer)llList2String(excludeFromCount, i);
       integer cIndex = llListFindList(inv_types, [(string)exclItem]);
       if (~cIndex)
           totalCount = totalCount - llGetInventoryNumber(exclItem);
   }
   
   counted += "\n \n" + "Total: " + (string)totalCount;
   llSetText(counted, <1,1,0>, 1);

}

default {

   state_entry()
   {
       processCountInventory();
   }
   
   changed(integer change)
   {
       if (change & CHANGED_INVENTORY)
       {
           processCountInventory();
       }
   }
}</lsl>

Siehe auch

Funktionen

•  llGetInventoryName Gibt den Namen des Gegenstands im Inventar
•  llGetInventoryType Prüft ob ein Gegenstand im Inventar existiert und gibt dessen Typ.
•  llGetInventoryCreator Gibt den Ersteller des Gegenstands im Inventar.
•  llGetInventoryPermMask Gibt die Befugnisse des Gegenstands im Inventar.
•  llGetInventoryKey Gibt die UUID eines Gegenstands im Inventar (falls alle Befugnisse gesetzt wurden)

Weiterführende Anmerkungen

Nach JIRA-Issues suchen, die sich hierauf beziehen

Tests

•  llGiveInventory_All_Test

Signature

function integer llGetInventoryNumber( integer type );
Dieser Artikel war nicht hilfreich für Dich? Vielleicht bringt der zugehörige Artikel im SLinfo Wiki Erleuchtung.