Difference between revisions of "LlGetInventoryType"
Jump to navigation
Jump to search
m (LlGetInventoryType moved to LSL llGetInventoryType) |
|||
Line 1: | Line 1: | ||
{{ | {{LSLFunctionAll | ||
|func_id=301 | |||
|func_sleep=0.0 | |||
|func_energy=10.0 | |||
| | |func=llGetInventoryType | ||
| | |return_type=integer | ||
= | |p1_type=string | ||
|p1_name=name | |||
|func_footnote=Returns the type of the inventory name | |||
|return_text | |||
|spec | |||
| | |caveats | ||
| | |examples | ||
|helpers | |||
|related | |||
|also | |||
|notes | |||
|constants={| {{Prettytable}} | |||
{| {{Prettytable}} | |||
|- valign="top" | |- valign="top" | ||
|| '''Flag''' | || '''Flag''' | ||
Line 69: | Line 66: | ||
|| [[gesture]] | || [[gesture]] | ||
|} | |} | ||
}} | |||
[[Category:LSL_Functions]][[Category:LSL_Stub]] | |||
{{lowercase|llGetInventoryType}} | |||
__NOTOC__ | |||
{| width="100%" | |||
|- | |||
|<div id="box"> | |||
== [[LSL_Type_integer|integer]] llGetInventoryType( [[LSL_Type_string|string]] name); == | |||
<div style="padding: 0.5em"> | |||
* name - The name of an inventory item. | |||
</div> | |||
</div> | |||
|- | |||
| | |||
<div id="box"> | |||
== Specification == | |||
<div style="padding: 0.5em"> | |||
This function returns the inventory type of the requested inventory item.<br /> | |||
If the item does not exist, INVENTORY_NONE is returned. | |||
</div> | </div> | ||
</div> | </div> |
Revision as of 22:46, 25 January 2007
Outdated templated used
Please change the template from 'LSLFunctionAll' to 'LSL_Function' (just replace 'LSLFunctionAll' with 'LSL_Function', do this after fixing any other erorr messages.
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Either 'func_desc' or 'return_type' & 'return_text' must be defined
(Please use 'return_text' & 'return_type' or 'func_desc' to summarize the functions actions.)
Summary
Function: integer llGetInventoryType( string name );301 | Function ID |
0.0 | Forced Delay |
10.0 | Energy |
Returns an integer
• string | name |
Returns the type of the inventory name
{
Caveats
Examples
Deep Notes
- The correct title of this article is llGetInventoryType. The initial letter is shown capitalized due to technical restrictions.
SpecificationThis function returns the inventory type of the requested inventory item.
|
Caveats
|
Examples |
Helper Functions<lsl> string InventoryName(string name, integer type) {//finds an item in a case insensitive fashion of the given type and returns its true name. integer a = llGetInventoryType(name); if(!~a)//a == INVENTORY_NONE {//it should be noted that INVENTORY_NONE == INVENTORY_ALL == -1; which is why '!~a' works. string lc_name = llToLower(name); a = llGetInventoryNumber(type); while(a) {//(a = ~-a) is equivalent to --a, but runs faster. if(llToLower(name = llGetInventoryName(type, a = ~-a)) == lc_name) {//we found a match ^_^ return name; } } } else if((a == type) ^ (!~type))//return name, aslong as a == type or type == INVENTORY_ALL {//we already know that a != INVENTORY_NONE, but just incase we use xor instead of or. return name; } return "";//no match ~_~ } integer InventoryExists(string name, integer type) {//only included to show how this type of check could be done if the value of 'type' is not constant and could be INVENTORY_ALL. return (llGetInventoryType(name) == type) ^ (!~type); }//Since INVENTORY_ALL == INVENTORY_NONE, the extra part on the end is required to invert the result. </lsl> |
See Also |
Notes |