Template:Needs Translation/
函数名
|
Function: string llGetInventoryName( integer type, integer number )
|
参数:
- integer type–INVENTORY_* flag
- integer number–Beginning from 0
|
返回值:返回一个字符串,该字符串是类型的库存项编号的名称。如果在prim的库存中没有找到指定类型的项(或者少于或等于该类型的项数),则返回一个空字符串。
|
注意事项
|
注意事项
- 如果number超出范围,脚本将继续执行,不会出现错误消息。
|
示例
|
Box Unpacker
// Give all prim contents to anyone touching this object,
// But don't give this script itself.
default
{
touch_start(integer num_detected)
{
list InventoryList;
integer count = llGetInventoryNumber(INVENTORY_ALL); // Count of all items in prim's contents
string ItemName;
while (count--)
{
ItemName = llGetInventoryName(INVENTORY_ALL, count);
if (ItemName != llGetScriptName() )
InventoryList += ItemName; // add all contents except this script, to a list
}
// Give all the items to the toucher, in a folder named as per this prim's name
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), InventoryList);
}
}
|