LlGetInventoryType/ja

From Second Life Wiki
< LlGetInventoryType
Revision as of 05:49, 10 April 2010 by Mako Nozaki (talk | contribs) (カテゴリ変更)
Jump to navigation Jump to search

要約

関数: integer llGetInventoryType( string name );

インベントリアイテムnameの型を integer で返します。

• string name インベントリアイテムの名前

アイテムが存在しない場合、INVENTORY_NONEが返されます。(エラーやメッセージは出力されません)

フラグ インベントリタイプ
INVENTORY_NONE -1 アイテムは存在しません。
INVENTORY_ALL 全てのインベントリタイプ
INVENTORY_TEXTURE 0 テクスチャ
INVENTORY_SOUND 1 サウンド
INVENTORY_LANDMARK 3 ランドマーク
INVENTORY_CLOTHING 5
フラグ インベントリタイプ
INVENTORY_OBJECT 6 オブジェクト
INVENTORY_NOTECARD 7 ノートカード
INVENTORY_SCRIPT 10 スクリプト
INVENTORY_BODYPART 13 体のパーツ
INVENTORY_ANIMATION 20 アニメーション
INVENTORY_GESTURE 21 ジェスチャー

サンプル

便利なスニペット

<lsl>string InventoryName(string name, integer type) {//finds an item in a case insensitive fashion of the given type and returns its true name.

   integer a = llGetInventoryType(name); 
   if(!~a)//a == INVENTORY_NONE
   {//it should be noted that INVENTORY_NONE == INVENTORY_ALL == -1; which is why '!~a' works.
       string lc_name = llToLower(name);
       a = llGetInventoryNumber(type);
       while(a)
       {//(a = ~-a) is equivalent to --a, but runs faster.
           if(llToLower(name = llGetInventoryName(type, a = ~-a)) == lc_name)
           {//we found a match ^_^
               return name;
           }
       }
   }
   else if((a == type) ^ (!~type))//return name, as long as a == type or type == INVENTORY_ALL
   {//we already know that a != INVENTORY_NONE, but just in case we use xor instead of or.
       return name;
   }
   return "";//no match ~_~

}

integer InventoryExists(string name, integer type) {//only included to show how this type of check could be done if the value of 'type' is not constant and could be INVENTORY_ALL.

   return (llGetInventoryType(name) == type) ^ (!~type);

}//Since INVENTORY_ALL == INVENTORY_NONE, the extra part on the end is required to invert the result.</lsl>

関連項目

特記事項

Search JIRA for related Issues

Signature

function integer llGetInventoryType( string name );
この翻訳は 原文 と比べて古いですか?間違いがありますか?読みにくいですか?みんなで 修正 していきましょう! (手順はこちら)
この項目はあなたにとって参考にならない項目ですか?もしかしたらLSL Wikiの関連した項目が参考になるかもしれません。