查看“LlGetInventoryNumber”的源代码
←
LlGetInventoryNumber
跳转至:
导航
、
搜索
因为以下原因,您没有权限编辑本页:
您所请求的操作仅限于该用户组的用户使用:
用户
您可以查看与复制此页面的源代码。
{{LSL Header|ml=*}}{{LSLC|Keywords}}{{LSLC|Flow Control}}{{LSLC|}} {{函数详情 |函数名 = Function: integer llGetInventoryNumber( integer type ) |参数= 参数:integer type–INVENTORY_* flag |返回值= 返回值:返回一个整数,表示prims库存中给定类型的项的数量。 |注意事项= 注意事项 |示例= <pre> // Item Counter // By Apollia Pirandello // 9/19/2007 // // Public domain. Free to use and/or modify for any purpose, // including commercial purposes. // // Once you drop this script in any prim, it will immediately // tell you in an OwnerSay how many items are in that prim, // minus 1, so the script itself isn't counted. // // It will also do that whenever the prim is touched. //**********SCRIPT BEGINS BELOW********** //****VARIABLE integer items_contained; //****END OF VARIABLE SECTION //****FUNCTIONS**** CountItems() { items_contained = llGetInventoryNumber( INVENTORY_ALL ); --items_contained; //minus 1, the script itself isn't counted, since its used with the INVENTORY_ALL flag } SayCount() { llOwnerSay( "This prim contains " + (string)items_contained + " items." ); } //****END OF FUNCTIONS**** //****DEFAULT STATE**** default { state_entry() { CountItems(); SayCount(); } touch_start(integer total_number) { CountItems(); SayCount(); } } objects = llGetInventoryNumber(INVENTORY_OBJECT); // Inventory Statistic By Zep Palen. // Here is another use of llGetInventoryNumber to show a statistic in a hovertext // For this script to work you must add a showlist and an excludelist to the Description of the item this script is in. // The description field must be filled like follows: [showlist];[Excludelist] // Example: 0,1,3,5,6,7,10,13,20,21;3,7,10 // in the example all types are shown, but only types 3,7 and 10 are counted as total. You can see in the 2 lists below which number means which type // ----------------- // This script is free to use and modify as you wish - Zep Palen // -------------------------- list inv_types = [0, 1, 3, 5, 6, 7, 10, 13, 20, 21]; list inv_names = ["Textures", "Sounds", "Landmarks", "Clothings", "Objects", "Notecards", "Scripts", "Bodyparts", "Animations", "Gestures"]; processCountInventory() { list objDesc = llParseString2List(llGetObjectDesc(), [";"], []); list showList = llParseString2List(llList2String(objDesc, 0), [","], []); list excludeFromCount = llParseString2List(llList2String(objDesc, 1), [","], []); string counted = "ITEM COUNTER"; integer i = ~llGetListLength(showList); while (++i) { integer showItem = (integer)llList2String(showList, i); integer sIndex = llListFindList(inv_types, [showItem]); if (~sIndex) counted += "\n" + llList2String(inv_names, sIndex) + ": " + (string)llGetInventoryNumber(showItem); } integer totalCount = llGetInventoryNumber(INVENTORY_ALL); for (i = ~llGetListLength(excludeFromCount); ++i;) { integer exclItem = (integer)llList2String(excludeFromCount, i); integer cIndex = llListFindList(inv_types, [(string)exclItem]); if (~cIndex) totalCount = totalCount - llGetInventoryNumber(exclItem); } counted += "\n \n" + "Total: " + (string)totalCount; llSetText(counted, <1,1,0>, 1); } default { state_entry() { processCountInventory(); } changed(integer change) { if (change & CHANGED_INVENTORY) { processCountInventory(); } } } </pre> |相关函数= [[llGetInventoryName]] -返回库存项的名称 [[llGetInventoryType]] -测试库存项是否存在并返回其类型 [[llGetInventoryCreator]] -返回库存物品的创建者 [[llGetInventoryPermmask]] -返回库存项的权限 [[llGetInventoryKey]] -返回库存项的UUID(如果是完整的perm) |相关事件= }}
该页面使用的模板:
模板:LSL Header
(
查看源代码
)
模板:LSLC
(
查看源代码
)
模板:LSLGC
(
查看源代码
)
模板:Multi-lang
(
查看源代码
)
模板:函数详情
(
查看源代码
)
返回至
LlGetInventoryNumber
。
导航菜单
个人工具
登录
名字空间
页面
讨论
变种
视图
阅读
查看源代码
查看历史
更多
搜索
导航
网站首页
知识百科
编辑帮助
最近更改
工具
链入页面
相关更改
特殊页面
页面信息