“LlGetInventoryType”的版本间的差异
(创建页面,内容为“{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名=Function:Function: string llList2CSV( list src ); |参数= 参数:sr…”) |
|||
(未显示1个用户的3个中间版本) | |||
第3行: | 第3行: | ||
{{函数详情 | {{函数详情 | ||
− | |函数名=Function: | + | |函数名 = Function: integer llGetInventoryType( string name ) |
− | |参数= | + | |参数= 参数:string name–name of an inventory item |
− | + | |返回值= 返回值:返回一个整数,该整数是库存项名称的类型 | |
− | |||
− | |||
− | |||
− | |返回值= | ||
+ | |注意事项= | ||
+ | 注意事项 | ||
− | |||
− | |||
− | |||
− | |示例= | + | |示例= |
− | + | <pre> | |
− | < | + | string get_type_info(integer inputInteger) |
+ | { | ||
+ | if (inputInteger == INVENTORY_TEXTURE) | ||
+ | return "INVENTORY_TEXTURE"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_SOUND) | ||
+ | return "INVENTORY_SOUND"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_LANDMARK) | ||
+ | return "INVENTORY_LANDMARK"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_CLOTHING) | ||
+ | return "INVENTORY_CLOTHING"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_OBJECT) | ||
+ | return "INVENTORY_OBJECT"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_NOTECARD) | ||
+ | return "INVENTORY_NOTECARD"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_SCRIPT) | ||
+ | return "INVENTORY_SCRIPT"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_BODYPART) | ||
+ | return "INVENTORY_BODYPART"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_ANIMATION) | ||
+ | return "INVENTORY_ANIMATION"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_GESTURE) | ||
+ | return "INVENTORY_GESTURE"; | ||
+ | |||
+ | else if (inputInteger == INVENTORY_SETTING) | ||
+ | return "INVENTORY_SETTING"; | ||
+ | |||
+ | // else | ||
+ | return "<!-- inventory type unknown --!>"; | ||
+ | } | ||
+ | |||
default | default | ||
{ | { | ||
− | + | touch_start(integer num_detected) | |
{ | { | ||
− | + | integer totalItems = llGetInventoryNumber(INVENTORY_ALL); | |
− | + | ||
+ | integer index; | ||
+ | while (index < totalItems) | ||
+ | { | ||
+ | string itemName = llGetInventoryName(INVENTORY_ALL, index); | ||
+ | integer type = llGetInventoryType(itemName); | ||
+ | |||
+ | // PUBLIC_CHANNEL has the integer value 0 | ||
+ | llSay(PUBLIC_CHANNEL, | ||
+ | "'" + itemName + "' (" + get_type_info(type) + ")"); | ||
+ | |||
+ | ++index; | ||
+ | } | ||
} | } | ||
} | } | ||
</pre> | </pre> | ||
+ | |相关函数= | ||
+ | [[llGetInventoryName]] -返回库存项的名称 | ||
+ | [[llGetInventoryNumber]] -返回库存中特定类型的项目的数量 | ||
+ | [[llGetInventoryCreator]] -返回库存物品的创建者 | ||
+ | [[llGetInventoryPermmask]] -返回库存项的权限 | ||
+ | [[llGetInventoryKey]] -返回库存项的UUID(如果是完整的perm) | ||
− | + | |相关事件= | |
− | | | + | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
}} | }} | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− |
2021年1月25日 (一) 08:33的最新版本
首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
函数名 |
---|
Function: integer llGetInventoryType( string name ) |
参数:string name–name of an inventory item |
返回值:返回一个整数,该整数是库存项名称的类型 |
注意事项 |
---|
注意事项 |
示例 |
---|
string get_type_info(integer inputInteger) { if (inputInteger == INVENTORY_TEXTURE) return "INVENTORY_TEXTURE"; else if (inputInteger == INVENTORY_SOUND) return "INVENTORY_SOUND"; else if (inputInteger == INVENTORY_LANDMARK) return "INVENTORY_LANDMARK"; else if (inputInteger == INVENTORY_CLOTHING) return "INVENTORY_CLOTHING"; else if (inputInteger == INVENTORY_OBJECT) return "INVENTORY_OBJECT"; else if (inputInteger == INVENTORY_NOTECARD) return "INVENTORY_NOTECARD"; else if (inputInteger == INVENTORY_SCRIPT) return "INVENTORY_SCRIPT"; else if (inputInteger == INVENTORY_BODYPART) return "INVENTORY_BODYPART"; else if (inputInteger == INVENTORY_ANIMATION) return "INVENTORY_ANIMATION"; else if (inputInteger == INVENTORY_GESTURE) return "INVENTORY_GESTURE"; else if (inputInteger == INVENTORY_SETTING) return "INVENTORY_SETTING"; // else return "<!-- inventory type unknown --!>"; } default { touch_start(integer num_detected) { integer totalItems = llGetInventoryNumber(INVENTORY_ALL); integer index; while (index < totalItems) { string itemName = llGetInventoryName(INVENTORY_ALL, index); integer type = llGetInventoryType(itemName); // PUBLIC_CHANNEL has the integer value 0 llSay(PUBLIC_CHANNEL, "'" + itemName + "' (" + get_type_info(type) + ")"); ++index; } } } |
相关函数 |
---|
llGetInventoryName -返回库存项的名称
llGetInventoryNumber -返回库存中特定类型的项目的数量 llGetInventoryCreator -返回库存物品的创建者 llGetInventoryPermmask -返回库存项的权限 llGetInventoryKey -返回库存项的UUID(如果是完整的perm) |
相关事件 |
---|