Jump to content

Remove all notecards in inventory


Finrod Ghennyn
 Share

You are about to reply to a thread that has been inactive for 4684 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Was wondering how i should remove all notecards in the objects inventory. I now have this and get loads of errors:

 notecard = llGetInventoryName(INVENTORY_NOTECARD, 0);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 1);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 2);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 3);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 4);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 5);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 6);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 7);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 8);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 9);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 10);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 11);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 12);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 13);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 14);
         llRemoveInventory(notecard);
                  notecard = llGetInventoryName(INVENTORY_NOTECARD, 15);
         llRemoveInventory(notecard);

Link to comment
Share on other sites

Thw problem is that you start from 1. Let's say there are 5 - if you delete the 1st one, there is no 5th one anymore - because there juzst 4 left - here ist a shorter solution that starts at the last one instead:

default {	touch_end(integer num_detected) {		integer num = llGetInventoryNumber(INVENTORY_NOTECARD);				while (num) {			llRemoveInventory(llGetInventoryName(INVENTORY_NOTECARD, num - 1));
--num;
} }}

 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4684 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...