LlGetInventoryType

来自人工智能助力教育知识百科
跳转至: 导航搜索

Template:Needs Translation/


函数名
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)

相关事件