“LlGiveInventoryList”的版本间的差异
| 第61行: | 第61行: | ||
} | } | ||
} | } | ||
| − | <pre> | + | </pre> |
| 第102行: | 第102行: | ||
} | } | ||
} | } | ||
| − | <pre> | + | </pre> |
2020年8月20日 (四) 10:18的最新版本
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: llGiveInventoryList( key target, string folder, list inventory ); |
参数:
|
| 返回值:
将库存项目提供给目标,创建一个新的文件夹来放置它们。 |
| 注意事项 |
|---|
*这个函数会让脚本休眠3.0秒。
|
| 示例 |
|---|
示例一
// 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
}
}
|
| 相关函数 |
|---|
| llGiveInventory |
| 相关事件 |
|---|
| changed |