LlGetInventoryType/ko
Jump to navigation
Jump to search
설명
함수: integer llGetInventoryType( string name );반환되는 값은 보관함 항목 name의 유형.
| • string | name | – | 보관함 항목의 이름 |
해당 물건이 존재하지 않는다면, 상수 INVENTORY_NONE이 반환된다. (오류 알림이 발생하지는 않는다).
|
| |||||||||||||||||||||||||||||||||||||||||
예제
유용한 조각
<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>
함께 보기
함수
| • | llGetInventoryName | – | 보관함 물체의 이름을 반환한다. | |
| • | llGetInventoryNumber | – | 보관함에서 특정 유형의 숫자를 반환한다. | |
| • | llGetInventoryCreator | – | 보관함 물체의 제작자를 반환한다. | |
| • | llGetInventoryPermMask | – | 보관함 물체의 권한을 반환한다. | |
| • | llGetInventoryKey | – | (해당 물체가 모든 권한일 때) 보관함 물체의 UUID를 반환한다. |
상세 기록
이 글이 유용하지 않으세요? LSL Wiki의 관련항목이 도움을 줄 수 있을 지도 모릅니다.