Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Determining if an item exists....

Toneless Tomba
(Insert Witty Title Here)
Join date: 13 Oct 2004
Posts: 241
07-27-2005 10:12
Is there a way to check to see if an item exists without going through a loop seaching for the item name in inventory?


I know about llGetInventoryKey() but you need full permissions and also llGetInventoryCreator() but if item does not exist it will return a NULL_KEY and also the same when item says it's created by nobody.
Vortex Saito
Quintzee Creator
Join date: 10 Sep 2004
Posts: 73
07-27-2005 10:22
I wish there were, would help me a lot. Haven't found one YET
_____________________
I don't care I am a lemming, I am NOT going !!!!

secondlife://puea/54/15
Tya Fallingbridge
Proud Prim Whore
Join date: 28 Aug 2003
Posts: 790
07-27-2005 10:30
From: Toneless Tomba
Is there a way to check to see if an item exists without going through a loop seaching for the item name in inventory?


I know about llGetInventoryKey() but you need full permissions and also llGetInventoryCreator() but if item does not exist it will return a NULL_KEY and also the same when item says it's created by nobody.




Why not filter your search....makes it a lil easier.. if you are looking for a script.. uncheck all the other boxes and leave the script one checked. The search will only return your desired query.
_____________________

Jillian Callahan
Rotary-winged Neko Girl
Join date: 24 Jun 2004
Posts: 3,766
07-27-2005 10:42
From: Tya Fallingbridge
Why not filter your search....makes it a lil easier.. if you are looking for a script.. uncheck all the other boxes and leave the script one checked. The search will only return your desired query.
They mean inside an item's inventory, and via a script.
_____________________
Toneless Tomba
(Insert Witty Title Here)
Join date: 13 Oct 2004
Posts: 241
08-04-2005 13:12
May have a solution for my question, it seems to work so far. Let me know if I'm missing something....

CODE
string objectname = "Object";  // NAME OF OBJECT

integer CheckInventory(string item) //RETURNS TRUE IF IN INVENTORY
{
if (llGetInventoryPermMask(item, MASK_OWNER) != 0) return TRUE; //PERM MASK WILL OUTPUT 0 AND ERROR MESSAGE IF NOT IN INVENTORY
else return FALSE;
}


default
{
touch_start(integer num_detected)
{
if (CheckInventory(objectname)) llSay(0, objectname + " is in inventory.");
else llSay(0, objectname + " is not in inventory.");
}
}
DJ Under
Pyro Island Manager
Join date: 9 Jan 2005
Posts: 55
Checks
08-04-2005 17:00
WOOOPS lol didn't mean that lol
Strife Onizuka
Moonchild
Join date: 3 Mar 2004
Posts: 5,887
08-04-2005 20:55
From: Toneless Tomba
CODE

integer CheckInventory(string item) //RETURNS TRUE IF IN INVENTORY
{
if (llGetInventoryPermMask(item, MASK_OWNER) != 0) return TRUE; //PERM MASK WILL OUTPUT 0 AND ERROR MESSAGE IF NOT IN INVENTORY
else return FALSE;
}


quicker if...
CODE

integer CheckInventory(string item) //RETURNS TRUE IF IN INVENTORY
{
return(llGetInventoryPermMask(item, MASK_OWNER) != 0);
}


in 1.7 we have been promised llGetInventoryType which won't display an error when passed non existant inventory.
_____________________
Truth is a river that is always splitting up into arms that reunite. Islanded between the arms, the inhabitants argue for a lifetime as to which is the main river.
- Cyril Connolly

Without the political will to find common ground, the continual friction of tactic and counter tactic, only creates suspicion and hatred and vengeance, and perpetuates the cycle of violence.
- James Nachtwey
Toneless Tomba
(Insert Witty Title Here)
Join date: 13 Oct 2004
Posts: 241
08-05-2005 08:24
From: Strife Onizuka
quicker if...
CODE

integer CheckInventory(string item) //RETURNS TRUE IF IN INVENTORY
{
return(llGetInventoryPermMask(item, MASK_OWNER) != 0);
}


doh! I've should had seen that. :p