Are you sure you need it using
getinventorylist? You can use
countitem2 to quickly make the check:
// Checking just the case of no cards compounded // countitem2(<item id>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>

// delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; if ( countitem2(Muffler_,1,10,0,0,0,0,0) && countitem2(Manteau_,1,10,0,0,0,0,0) ) { delitem2(Muffler_,1,1,10,0,0,0,0,0); delitem2(Manteau_,1,1,10,0,0,0,0,0); getitem Apple,1; } else { dispbottom "NOPE!"; }
In case it's strictly necessary to use
getinventorylist, then it's a bit less simple:
/* getinventorylist returns: @inventorylist_id[] - array of item ids. @inventorylist_amount[] - their corresponding item amounts. @inventorylist_equip[] - will return the slot the item is equipped on, if at all. @inventorylist_refine[] - for how much it is refined. @inventorylist_identify[] - whether it is identified. @inventorylist_attribute[] - whether it is broken. @inventorylist_card1[] - These four arrays contain card data for the @inventorylist_card2[] items. These data slots are also used to store @inventorylist_card3[] names inscribed on the items, so you can @inventorylist_card4[] explicitly check if the character owns an item made by a specific craftsman. @inventorylist_expire[] - expire time (Unix time stamp). 0 means never expires. @inventorylist_bound - whether it is an account bounded item or not. @inventorylist_count - the number of items in these lists delitem2 <item id>,<amount>,<identify>,<refine>,<attribute>,<card1>,<card2>,<card3>,<card4>{,<account ID>}; */ setarray .@requitems[1], Muffler_, Manteau_; //Muffler_ and Manteau_ (both slotted) getinventorylist; // Looping for each item for ( .@cur_item = 1; .@cur_item <= getarraysize(.@requitems); .@cur_item++ ) { // Looping the whole inventory till we find the required item for ( .@j = 0; .@j < @inventorylist_count; .@j++) { // Is this OUR desired item? if (@inventorylist_id[.@j] == .@requitems[cur_item] && @inventorylist_refine == 10) { // Fill up some arrays with all the info to use with delitem in case we have all required items .@item_identify[.@cur_item] = @inventorylist_identify[.@cur_item]; .@item_refine[.@cur_item] = @inventorylist_refine[.@cur_item]; // Could be directly 10, but making a general case .@item_attribute[.@cur_item] = @inventorylist_attribute[.@cur_item]; .@item_card1[.@cur_item] = @inventorylist_card1[.@cur_item]; .@item_card2[.@cur_item] = @inventorylist_card2[.@cur_item]; .@item_card3[.@cur_item] = @inventorylist_card3[.@cur_item]; .@item_card4[.@cur_item] = @inventorylist_card4[.@cur_item]; // And no need to continue doing this loop break; } // Can we confirm it is impossible to have this current items? if (.@j == @inventorylist_count -1) { .@deny = 1; dispbottom "You're missing at least a ^0000FF" + getitemname(.@requitems[cur_item]) + "^000000."; end; // No need to run the script anymore } } sleep 1; // The processor could be needed for something more important than this } // OK, we should have the items ready at this point, so loop to remove them for ( .@cur_item = 1; .@cur_item <= getarraysize(.@requitems); .@cur_item++ ) { delitem2 .@requitems[.@cur_item],1,.@item_identify[.@cur_item],.@item_refine[.@cur_item],.@item_attribute[.@cur_item],.@item_card1[.@cur_item],.@item_card2[.@cur_item],.@item_card3[.@cur_item],.@item_card4[.@cur_item]; } // And you've got your gift now! getitem Apple, 1; end;
NOTE: Untested but
checked. Should work unless I typo'd somewhere, in that case please tell me.
P.S.: Yep, I usually copy over the documentation so no need to change tabs or windows while programming