Template:Needs Translation/
函数名
|
Function: llGiveInventoryList( key target, string folder, list inventory );
|
参数:
- key target – group, avatar or prim UUID that is in the same region
- string folder – folder name to use
- list inventory – a list of items in the inventory of the prim this script is in
|
返回值:
将库存项目提供给目标,创建一个新的文件夹来放置它们。
|
注意事项
|
*这个函数会让脚本休眠3.0秒。
- 如果目标不是所有者,也不共享相同的所有者,并且库存没有传输权限,则在 debug _ channel 上呼叫错误。
- 如果库存权限不允许复制,则传输失败,并在 debug _ channel 上呼叫错误。
- 如果目标是不在同一区域的 prim,则在 debug _ 通道上呼叫错误
- 当脚本被复制或在库存之间移动时,它们的状态无法在传输过程中存活。内存、事件队列和执行位置都被丢弃。
- 如果库存缺失的 prim 的目录,然后一个错误是在调试通道喊。
|
示例
|
示例一
// when the prim is touched, the script checks all other inventory items whether or not they're copiable
// copiable items are added to a list, if the list is not empty when all items have been checked
// the prim gives them to the touching avatar within a single folder
default
{
touch_start(integer num_detected)
{
string thisScript = llGetScriptName();
list inventoryItems;
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
for ( ; index < inventoryNumber; ++index )
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (itemName != thisScript)
{
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
inventoryItems += itemName;
}
else
{
llSay(0, "Unable to copy the item named '" + itemName + "'.");
}
}
}
if (inventoryItems == [] )
{
llSay(0, "No copiable items found, sorry.");
}
else
{
llGiveInventoryList(llDetectedKey(0), llGetObjectName(), inventoryItems); // 3.0 seconds delay
}
}
}
示例二
// script gives items to owner only
// all copiable items are given within a single folder
// all no-copy items are transferred separately (only one time, right? right!)
default
{
touch_start(integer num_detected)
{
key owner = llGetOwner();
if (llDetectedKey(0) != owner)
return;
list inventoryItems;
integer inventoryNumber = llGetInventoryNumber(INVENTORY_ALL);
integer index;
for ( ; index < inventoryNumber; ++index )
{
string itemName = llGetInventoryName(INVENTORY_ALL, index);
if (itemName != llGetScriptName() )
{
if (llGetInventoryPermMask(itemName, MASK_OWNER) & PERM_COPY)
{
inventoryItems += itemName;
}
else
{
llGiveInventory(owner, itemName); // 2.0 seconds delay
}
}
}
if (inventoryItems != [] )
llGiveInventoryList(owner, llGetObjectName(), inventoryItems); // 3.0 seconds delay
}
}
|