Jump to content
  • 0
Sign in to follow this  
astralprojection

How to filter getinventorylist

Question

	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?

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 1

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

	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.

 

Edited by Myriad

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.