LlRequestInventoryData
| 首页 | 函数 | 事件 | 类型 | 操作符 | 常数 | Flow Control | Script Library | Categorized Library | Tutorials |
| 函数名 |
|---|
| Function: key llRequestInventoryData( string name ); |
| 参数:• string name –该脚本所在的prim库存中的一项 |
| 返回值:请求关于prim库存中的项目名称的数据。当数据可用时,将引发dataserver事件。
返回句柄(键),该句柄用于在引发dataserver事件时标识该事件。 |
| 注意事项 |
|---|
| 这个函数使脚本休眠1.0秒。
如果名字没有出现在prim的目录中,那么DEBUG_CHANNEL将显示错误。 此函数仅返回库存中具有里程碑意义的物品的数据。不支持其他项类型。 上述dataserver事件中返回的向量的描述表明该值是一个区域坐标;实际上,它表示了路标位置相对于脚本运行区域<0,0,0>的距离(以米为单位)。对于指向当前区域内某一位置的地标,与区域坐标相同;但是,当使用指向不同区域的地标时,向量的x和y值可能相当大(和/或负)。该向量适合用于计算全局坐标(如上所述)或路标与当前区域或整个Second Life网格中包含脚本的对象之间的距离。 |
| 示例 |
|---|
示例1
//-- Open map for owner to 1st landmark in object inventory on touch
//-- *MUST* be in an attached object (llMapDestination Requirement for non-touch use)
key vgKeyOwner;
default
{
touch_start( integer vIntNull )
{
if (llDetectedKey( 0 ) == vgKeyOwner)
{
integer vIntLMcount = llGetInventoryNumber( INVENTORY_LANDMARK );
//-- make sure we have a landmark in invetory
if (vIntLMcount)
{
llRequestInventoryData( llGetInventoryName( INVENTORY_LANDMARK, 0 ) );
}
}
}
dataserver( key vKeyNull, string vStrData )
{
//-- because we don't know who touched us in this event, this
//-- only works for the owner when called from the dataserver
llMapDestination( llGetRegionName(), (vector)vStrData, ZERO_VECTOR );
}
on_rez( integer vIntNull )
{
llResetScript();
}
state_entry()
{
vgKeyOwner = llGetOwner();
}
}
示例2 |
| 相关函数 |
|---|
| llMapDestination |
| 相关事件 |
|---|
| dataserver |
附录:(表格)
| name's Inventory Type | dataserver | Description |
|---|---|---|
| Landmark | (vector) | dataserver接收到的矢量数据是当前区域<0,0,0>的偏移量。要获得地标的全局位置,请添加llGetRegionCorner()。 |