Jump to content
  • 0

[SOLVED] help select + menu


namerpus18

Question


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.07
  • Content Count:  107
  • Reputation:   5
  • Joined:  11/15/22
  • Last Seen:  

Good Day Everyone,

Please help me I want to make all cards in my inventory show in the select menu. 

Thank you so much, ~NOOB

prontera,164,200,4	script	selectcard	112,{
getinventorylist();
setarray .@menulist[0],0;
.@j = 0; 

	for (.@i = 0; .@i < @inventorylist_count; ++.@i)
	{
		.@idd = @inventorylist_id[.@i];
		.@type = getiteminfo(.@idd,2); 
			if (.@type == 6)
			{
			
			.@menulist[@j] = .@idd;
			
			.@j++;
	
			dispbottom .@menulist[@j]; 
			}
			
	}
	
	for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i)
		{

		.@menu$ = .@menu$ + getitemname(.@menulist[.@i]);
		.@menu$ = .@menu$ + ":";
		.@part = .@menulist[select(.@menu$)];

		}
		.@part = .@menulist[select(.@menu$)];

end;	
}

 

Edited by namerpus18
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

getinventorylist;
for (.@i = 0; .@i < @inventorylist_count; .@i++) {
	if (getiteminfo(@inventorylist_id[.@i], ITEMINFO_TYPE) == IT_CARD)
		.@menu$ = .@menu$ + getitemname(@inventorylist_id[.@i]);
	.@menu$ = .@menu$ + ":";
}
.@i = select(.@menu$) - 1;
mes "Your selected card = " + getitemname(@inventorylist_id[.@i]);

you can also do this this way.

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  0
  • Topics Per Day:  0
  • Content Count:  133
  • Reputation:   54
  • Joined:  06/02/12
  • Last Seen:  

Hi, In the following line there's a missing .(dot) in the variable name:

.@menulist[@j] = .@idd;

To:

.@menulist[.@j] = .@idd;

 

In this part you wrote the same select command line twice:

	for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i)
		{

		.@menu$ = .@menu$ + getitemname(.@menulist[.@i]);
		.@menu$ = .@menu$ + ":";
		.@part = .@menulist[select(.@menu$)];

		}
		.@part = .@menulist[select(.@menu$)];

Remove the first one, and add -1 in the second. Like this:

	for (.@i = 0; .@i < getarraysize(.@menulist); ++.@i)
		{

		.@menu$ = .@menu$ + getitemname(.@menulist[.@i]);
		.@menu$ = .@menu$ + ":";

		}
		.@part = .@menulist[select(.@menu$) - 1];

 

  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.07
  • Content Count:  107
  • Reputation:   5
  • Joined:  11/15/22
  • Last Seen:  

38 minutes ago, Racaae said:

Hi, In the following line there's a missing .(dot) in the variable name:

Hi thank you so much, it worked. 🙂

Link to comment
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.   Paste as plain text instead

  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.

×
×
  • Create New...