Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

llGiveInventory and llRemove Inventory Issue

Claari Shepherd
Danri CEO and Designer
Join date: 20 Feb 2007
Posts: 170
09-22-2008 14:29
Hello Scripters!

I have this script that I have heavily modified to accept inventory and to give that inventory to access list users. The entire script is working perfectly as intended except I receive the following message:
Unable to give inventory: 'No item named ''.'.
Missing inventory item ''.

As you can it doesn't specify what it thinks it's missing. Here's the script portion causing me to go bald :)

CODE


touch_start(integer total_number)
{

integer i;
for (i=0;i<total_number;i++)
{
key target = llDetectedKey(i);
if(llListFindList(authaccess, (list)llKey2Name(llDetectedKey(0))) != -1)
{
list inventory_types = [INVENTORY_BODYPART,INVENTORY_CLOTHING,INVENTORY_LANDMARK,INVENTORY_NOTECARD,INVENTORY_OBJECT,INVENTORY_SCRIPT,INVENTORY_SOUND,INVENTORY_TEXTURE];
integer inventory_count = llGetListLength(inventory_types);
integer j;
integer k;
integer t;
integer typecount;
string myname = llGetScriptName();
string objectname;

for (j=0; j<inventory_count;j++)
{
t = llList2Integer(inventory_types,j); // Get next Inventory type
typecount = llGetInventoryNumber(t); // How many of that type in inventory

if (typecount > 0)
{
for (k=0; k<typecount;k++)
{
objectname = llGetInventoryName(t,k);
if (objectname != myname) // Dont give out the script
{
if (objectname != (string)"AppBoxConfig") //Dont give out config card
{
if (objectname != application) //Dont give out information card
{
llGiveInventory(target,objectname);
llRemoveInventory(objectname);
}
}
}
}
}
}
}

else
{
llGiveInventory((llDetectedKey(0)),application); //Give unauthorized users information card
}
}
}

CODE
Winter Ventura
Eclectic Randomness
Join date: 18 Jul 2006
Posts: 2,579
09-22-2008 15:46
it IS specifying what is missing...

it's looking for an inventory item named "" (NULL_STRING).

Try looking at your numbers. I'll bet you're searching inventory items Zero, through llGetInventoryNumber.

If there are 18 items, there are only items 0-17. When it searches for 18, it finds "NULL_STRING" (not found).

Add a quick:

if (name != "";)

Or just a - 1 to llGetInventoryNumber.
_____________________

● Inworld Store: http://slurl.eclectic-randomness.com
● Website: http://www.eclectic-randomness.com
● Twitter: @WinterVentura
Claari Shepherd
Danri CEO and Designer
Join date: 20 Feb 2007
Posts: 170
09-22-2008 20:02
Thanks Winter... I got it worked out.