Jump to content
  • 0

list instead of range


kalabasa

Question


  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

	set .@menu$, "";
	set .@a, .orbs[0];
	while((set(.@a,.@a+1)-1)<=.orbs[1])
		if(getiteminfo(.@a-1,2)>-1)
			if(set(.@c,countitem(.@a-1))) {
				set .@menu$, .@menu$+getitemname(.@a-1)+" x"+.@c+":";
				set .@b,.@b+1; set .@item[.@b], .@a-1;
			}
			
	if(.@menu$=="") {
		mes .npc$;
		mes "Hmm, you don't seem to have any enchantment orbs.";
		close;
	}

	mes .npc$;
	mes "Please, select an enchantment from the menu."; next;
	select(.@menu$);
	set .@itm, .@item[@menu];
    
    
    setarray .orbs,	4702,4712,4722,4732,4742,4752,4767,4834; 

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 1

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

Hi

	set .@menu$, "";
	for (.@i = 0; .@i < getarraysize(.orbs); .@i++) {
		.@qty = countitem(.orbs[.@i]);
		if (.@qty)
			.@menu$ += getitemname(.orbs[.@i])+" x"+.@qty+":";
		else
			.@menu$ += ":";
	}

	if(.@menu$=="") {
		mes .npc$;
		mes "Hmm, you don't seem to have any enchantment orbs.";
		close;
	}

	mes .npc$;
	mes "Please, select an enchantment from the menu."; next;
	select(.@menu$);
	set .@itm, .orbs[@menu-1];
    
OnInit:
	setarray .orbs,	4702,4712,4722,4732,4742,4752,4767,4834;
	end;

 

  • Upvote 1
Link to comment
Share on other sites

  • 1

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

On 4/11/2023 at 9:27 AM, Racaae said:

Hi

	set .@menu$, "";
	for (.@i = 0; .@i < getarraysize(.orbs); .@i++) {
		.@qty = countitem(.orbs[.@i]);
		if (.@qty)
			.@menu$ += getitemname(.orbs[.@i])+" x"+.@qty+":";
		else
			.@menu$ += ":";
	}

	if(.@menu$=="") {
		mes .npc$;
		mes "Hmm, you don't seem to have any enchantment orbs.";
		close;
	}

	mes .npc$;
	mes "Please, select an enchantment from the menu."; next;
	select(.@menu$);
	set .@itm, .orbs[@menu-1];
    
OnInit:
	setarray .orbs,	4702,4712,4722,4732,4742,4752,4767,4834;
	end;

 

 

well it would skip if(.@menu$=="") since the generated string in variable .@menu$ would be like "::::::::" depending of size of the orbs. 

	set .@menu$, "";
	for (.@i = 0; .@i < getarraysize(.orbs); .@i++) {
		.@qty = countitem(.orbs[.@i]);
		if (.@qty) {
			.@avail = 1;
			.@menu$ += getitemname(.orbs[.@i])+" x"+.@qty+":";
		}
		else
			.@menu$ += ":";
	}

	if(!.@avail) {
		mes .npc$;
		mes "Hmm, you don't seem to have any enchantment orbs.";
		close;
	}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Donators
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  10/31/12
  • Last Seen:  

what is it exactly are you trying to achieve?? 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

i want exactly on the setarray .orbs to be exactly selected

as for now its taking a range for example these first two 4702,4712 (this covers 4702,03,04,05,06,07,08,09,10,11,12)

Link to comment
Share on other sites

  • 0

  • Group:  Donators
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  10/31/12
  • Last Seen:  

you mean it should go like +1 step at a time?

4702 - 4711 ( then continue get .orbs[1] until .orbs[2] ) is that right??

setarray .orbs,	4702,4712,4722,4732,4742,4752,4767,4834; 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  123
  • Topics Per Day:  0.05
  • Content Count:  478
  • Reputation:   14
  • Joined:  11/30/17
  • Last Seen:  

i want only these item-id to be listed

as for my test if you have 4703 on your inventory it will pop out in the menu but it should not

Link to comment
Share on other sites

  • 0

  • Group:  Donators
  • Topic Count:  2
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   2
  • Joined:  10/31/12
  • Last Seen:  

its so hard to understand your request since u do not have a clear goal.

if u want to check item is in inventory just use countitem(item_id)

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...