How to filter getinventorylist

astralprojection

New member
Messages
334
Points
0
getinventorylist;
.@i = 0;
while ( .@i < @inventorylist_count ) {

/* Filter only items that is not bound */
if (!@inventorylist_bound[.@i]){
.@itemname$ = callfunc( "getitemname2", @inventorylist_id[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], @inventorylist_bound[.@i]);
.@menu$ = .@menu$ + @itemname2_info$ + .@itemname$ +":";
}
.@i++;
}
.@s = select(.@menu$) -1;

/* Now display ItemID of selected inventory */
mes "You have selected "+@inventorylist_id[.@s]; // this did not return correct info because it reads [.@s] index from getinventorylist but not the filtered menu.




1.  I list all inventory.
2. I remove all bound items
3. i want to get correct index of  items selected from the  menu.  Any suggestion how to handle this?

 
How about this? It should store every non-bound item in a new array .@ID[]

Code:
	getinventorylist();
	for (.@i = 0; .@i < @inventorylist_count; .@i++) {
		/* Filter only items that is not bound */
		if (!@inventorylist_bound[.@i]){
			.@itemname$ = callfunc( "getitemname2", @inventorylist_id[.@i], @inventorylist_identify[.@i], @inventorylist_refine[.@i], @inventorylist_attribute[.@i], @inventorylist_card1[.@i], @inventorylist_card2[.@i], @inventorylist_card3[.@i], @inventorylist_card4[.@i], @inventorylist_bound[.@i]);
			.@menu$ += sprintf("%s %s:", @itemname2_info$, .@itemname$);
			.@ID[.@j] = @inventorylist_id[.@i];
			.@j++;
		}
	}
	.@menu$ += "Cancel";
	.@s = select(.@menu$) -1;
	if (.@s == .@j)
		close;
	
	/* Now display ItemID of selected inventory */
	mesf("You have selected %d", .@ID[.@s]);  // this did not return correct info because it reads [.@s] index from getinventorylist but not the filtered menu.
 
Last edited by a moderator:
Back
Top