Difference between revisions of "LlGetInventoryNumber"
m |
Void Singer (talk | contribs) m (added example) |
||
Line 9: | Line 9: | ||
|caveats | |caveats | ||
|constants={{LSL Constants Inventory}} | |constants={{LSL Constants Inventory}} | ||
|examples=<pre>objects = llGetInventoryNumber(INVENTORY_OBJECT);</pre> | |examples=<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> | |||
<pre>objects = llGetInventoryNumber(INVENTORY_OBJECT);</pre> | |||
|helpers | |helpers | ||
|also_functions= | |also_functions= |
Revision as of 21:46, 12 December 2007
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: integer llGetInventoryNumber( integer type );146 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns an integer that is the number of items of a given type in the prims inventory.
• integer | type | – | INVENTORY_* flag |
|
|
Caveats
Examples
<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>
objects = llGetInventoryNumber(INVENTORY_OBJECT);
See Also
Functions
• | llGetInventoryName | |||
• | llGetInventoryCreator | |||
• | llGetInventoryKey | |||
• | llGetInventoryType |