• 0
Sign in to follow this  
Followers 0
astralprojection

How to filter getinventorylist

Question

	getinventorylist;
	[email protected] = 0;
	while ( [email protected] < @inventorylist_count ) {
	
		/* Filter only items that is not bound */
		if ([email protected]_bound[[email protected]]){
			[email protected]$ = callfunc( "getitemname2", @inventorylist_id[[email protected]], @inventorylist_identify[[email protected]], @inventorylist_refine[[email protected]], @inventorylist_attribute[[email protected]], @inventorylist_card1[[email protected]], @inventorylist_card2[[email protected]], @inventorylist_card3[[email protected]], @inventorylist_card4[[email protected]], @inventorylist_bound[[email protected]]);
			[email protected]$ = [email protected]$ + @itemname2_info$ + [email protected]$ +":";
		}
		[email protected]++;
	}
	[email protected] = select([email protected]$) -1;
	
	/* Now display ItemID of selected inventory */
	mes "You have selected "[email protected]_id[[email protected]];  // this did not return correct info because it reads [[email protected]] 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?

Share this post


Link to post
Share on other sites

2 answers to this question

  • 1

Posted (edited)

How about this? It should store every non-bound item in a new array [email protected][]

	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 [[email protected]] index from getinventorylist but not the filtered menu.

 

Edited by Myriad

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0