Jump to content
  • 0
RiverStyx

Specific options within a menu!

Question

Not going to bother posting the entire script since it's over 4,000 lines and such, but essentially I want to make sure that a menu option will display correctly.

Variables #AlootSet1ID1 and so on has been set with an item ID already in the script, so, when creating an if command prior to making a switch select.. will this work?

 

if (#AlootSet1ID1 != 0) { set @menu$[1], "Add Item"; } else { set @menu$[1], "Item ID "+#AlootSet1ID1+" - ("+getitemname(#AlootSet1ID1)"+)"; 

 

I want it to essentially say as a MENU option

 

Item ID 969 - Gold

 

 

will it work? :D

Share this post


Link to post
Share on other sites

5 answers to this question

Recommended Posts

  • 0

why not use something like this

 

 

switch (select ( #AlootSet1ID1 != 0? "Item ID "+#AlootSet1ID1+" - ("+getitemname(#AlootSet1ID1)+")": "Add Item" ) )

Share this post


Link to post
Share on other sites
  • 0

I currently have it set up like this,

 

						if (#AlootSet1ID1 != 0) { set @menu$[1], "Add Item"; } else { set @menu$[1], "Item ID "+#AlootSet1ID1+" - ("+getitemname(#AlootSet1ID1)"+)"; }						if (#AlootSet1ID2 != 0) { set @menu$[2], "Add Item"; } else { set @menu$[2], "Item ID "+#AlootSet1ID2+" - ("+getitemname(#AlootSet1ID2)"+)"; }						if (#AlootSet1ID3 != 0) { set @menu$[3], "Add Item"; } else { set @menu$[3], "Item ID "+#AlootSet1ID3+" - ("+getitemname(#AlootSet1ID3)"+)"; }						if (#AlootSet1ID4 != 0) { set @menu$[4], "Add Item"; } else { set @menu$[4], "Item ID "+#AlootSet1ID4+" - ("+getitemname(#AlootSet1ID4)"+)"; }						if (#AlootSet1ID5 != 0) { set @menu$[5], "Add Item"; } else { set @menu$[5], "Item ID "+#AlootSet1ID5+" - ("+getitemname(#AlootSet1ID5)"+)"; }						if (#AlootSet1ID6 != 0) { set @menu$[6], "Add Item"; } else { set @menu$[6], "Item ID "+#AlootSet1ID6+" - ("+getitemname(#AlootSet1ID6)"+)"; }						if (#AlootSet1ID7 != 0) { set @menu$[7], "Add Item"; } else { set @menu$[7], "Item ID "+#AlootSet1ID7+" - ("+getitemname(#AlootSet1ID7)"+)"; }						if (#AlootSet1ID8 != 0) { set @menu$[8], "Add Item"; } else { set @menu$[8], "Item ID "+#AlootSet1ID8+" - ("+getitemname(#AlootSet1ID8)"+)"; }						if (#AlootSet1ID9 != 0) { set @menu$[9], "Add Item"; } else { set @menu$[9], "Item ID "+#AlootSet1ID9+" - ("+getitemname(#AlootSet1ID9)"+)"; }						if (#AlootSet1ID10 != 0) { set @menu$[10], "Add Item"; } else { set @menu$[10], "Item ID "+#AlootSet1ID10+" - ("+getitemname(#AlootSet1ID10)"+)"; }						if (#AlootSet1ID11 != 0) { set @menu$[11], "Add Item"; } else { set @menu$[11], "Item ID "+#AlootSet1ID11+" - ("+getitemname(#AlootSet1ID11)"+)"; }						if (#AlootSet1ID12 != 0) { set @menu$[12], "Add Item"; } else { set @menu$[12], "Item ID "+#AlootSet1ID12+" - ("+getitemname(#AlootSet1ID12)"+)"; }						if (#AlootSet1ID13 != 0) { set @menu$[13], "Add Item"; } else { set @menu$[13], "Item ID "+#AlootSet1ID13+" - ("+getitemname(#AlootSet1ID13)"+)"; }						if (#AlootSet1ID14 != 0) { set @menu$[14], "Add Item"; } else { set @menu$[14], "Item ID "+#AlootSet1ID14+" - ("+getitemname(#AlootSet1ID14)"+)"; }						if (#AlootSet1ID15 != 0) { set @menu$[15], "Add Item"; } else { set @menu$[15], "Item ID "+#AlootSet1ID15+" - ("+getitemname(#AlootSet1ID15)"+)"; }						if (#AlootSet1ID16 != 0) { set @menu$[16], "Add Item"; } else { set @menu$[16], "Item ID "+#AlootSet1ID16+" - ("+getitemname(#AlootSet1ID16)"+)"; }						if (#AlootSet1ID17 != 0) { set @menu$[17], "Add Item"; } else { set @menu$[17], "Item ID "+#AlootSet1ID17+" - ("+getitemname(#AlootSet1ID17)"+)"; }						if (#AlootSet1ID18 != 0) { set @menu$[18], "Add Item"; } else { set @menu$[18], "Item ID "+#AlootSet1ID18+" - ("+getitemname(#AlootSet1ID18)"+)"; }						if (#AlootSet1ID19 != 0) { set @menu$[19], "Add Item"; } else { set @menu$[19], "Item ID "+#AlootSet1ID19+" - ("+getitemname(#AlootSet1ID19)"+)"; }						if (#AlootSet1ID20 != 0) { set @menu$[20], "Add Item"; } else { set @menu$[20], "Item ID "+#AlootSet1ID20+" - ("+getitemname(#AlootSet1ID20)"+)"; }						if (#AlootSet1ID21 != 0) { set @menu$[21], "Add Item"; } else { set @menu$[21], "Item ID "+#AlootSet1ID21+" - ("+getitemname(#AlootSet1ID21)"+)"; }						if (#AlootSet1ID22 != 0) { set @menu$[22], "Add Item"; } else { set @menu$[22], "Item ID "+#AlootSet1ID22+" - ("+getitemname(#AlootSet1ID22)"+)"; }						if (#AlootSet1ID23 != 0) { set @menu$[23], "Add Item"; } else { set @menu$[23], "Item ID "+#AlootSet1ID23+" - ("+getitemname(#AlootSet1ID23)"+)"; }						if (#AlootSet1ID24 != 0) { set @menu$[24], "Add Item"; } else { set @menu$[24], "Item ID "+#AlootSet1ID24+" - ("+getitemname(#AlootSet1ID24)"+)"; }						if (#AlootSet1ID25 != 0) { set @menu$[25], "Add Item"; } else { set @menu$[25], "Item ID "+#AlootSet1ID25+" - ("+getitemname(#AlootSet1ID25)"+)"; }						next;						switch(select(@menu$[1],@menu$[2],@menu$[3],@menu$[4],@menu$[5],@menu$[6],@menu$[7],@menu$[8],@menu$[9],@menu$[10],@menu$[11],@menu$[12],@menu$[13],@menu$[14],@menu$[15],@menu$[16],@menu$[17],@menu$[18],@menu$[19],@menu$[20],@menu$[21],@menu$[22],@menu$[23],@menu$[24],@menu$[25]))

 

So I don't want one menu selection to be what it lists, I want multiple menu sections to be a result of the if command, later on the script I have 25 different cases that'll do 25different variable changes.

 

Edit: http://upaste.me/845613346362febb2 If anyone wants to give it a full shot.

Edited by RiverStyx

Share this post


Link to post
Share on other sites
  • 0

Completed without any further problems, with the help of the quesoph.

 

 

						switch (select ( #AlootSet3ID1 != 0? "Item ID "+#AlootSet3ID1+" - ("+getitemname(#AlootSet3ID1)+")": "Add Item",#AlootSet3ID2 != 0? "Item ID "+#AlootSet3ID2+" - ("+getitemname(#AlootSet3ID2)+")": "Add Item",#AlootSet3ID3 != 0? "Item ID "+#AlootSet3ID3+" - ("+getitemname(#AlootSet3ID3)+")": "Add Item",#AlootSet3ID4 != 0? "Item ID "+#AlootSet3ID4+" - ("+getitemname(#AlootSet3ID4)+")": "Add Item",#AlootSet3ID5 != 0? "Item ID "+#AlootSet3ID5+" - ("+getitemname(#AlootSet3ID5)+")": "Add Item",#AlootSet3ID6 != 0? "Item ID "+#AlootSet3ID6+" - ("+getitemname(#AlootSet3ID6)+")": "Add Item",#AlootSet3ID7 != 0? "Item ID "+#AlootSet3ID7+" - ("+getitemname(#AlootSet3ID7)+")": "Add Item",#AlootSet3ID8 != 0? "Item ID "+#AlootSet3ID8+" - ("+getitemname(#AlootSet3ID8)+")": "Add Item",#AlootSet3ID9 != 0? "Item ID "+#AlootSet3ID9+" - ("+getitemname(#AlootSet3ID9)+")": "Add Item",#AlootSet3ID10 != 0? "Item ID "+#AlootSet3ID10+" - ("+getitemname(#AlootSet3ID10)+")": "Add Item",#AlootSet3ID11 != 0? "Item ID "+#AlootSet3ID11+" - ("+getitemname(#AlootSet3ID11)+")": "Add Item",#AlootSet3ID12 != 0? "Item ID "+#AlootSet3ID12+" - ("+getitemname(#AlootSet3ID12)+")": "Add Item",#AlootSet3ID13 != 0? "Item ID "+#AlootSet3ID13+" - ("+getitemname(#AlootSet3ID13)+")": "Add Item",#AlootSet3ID14 != 0? "Item ID "+#AlootSet3ID14+" - ("+getitemname(#AlootSet3ID14)+")": "Add Item",#AlootSet3ID15 != 0? "Item ID "+#AlootSet3ID15+" - ("+getitemname(#AlootSet3ID15)+")": "Add Item",#AlootSet3ID16 != 0? "Item ID "+#AlootSet3ID16+" - ("+getitemname(#AlootSet3ID16)+")": "Add Item",#AlootSet3ID17 != 0? "Item ID "+#AlootSet3ID17+" - ("+getitemname(#AlootSet3ID17)+")": "Add Item",#AlootSet3ID18 != 0? "Item ID "+#AlootSet3ID18+" - ("+getitemname(#AlootSet3ID18)+")": "Add Item",#AlootSet3ID19 != 0? "Item ID "+#AlootSet3ID19+" - ("+getitemname(#AlootSet3ID19)+")": "Add Item",#AlootSet3ID20 != 0? "Item ID "+#AlootSet3ID20+" - ("+getitemname(#AlootSet3ID20)+")": "Add Item",#AlootSet3ID21 != 0? "Item ID "+#AlootSet3ID21+" - ("+getitemname(#AlootSet3ID21)+")": "Add Item",#AlootSet3ID22 != 0? "Item ID "+#AlootSet3ID22+" - ("+getitemname(#AlootSet3ID22)+")": "Add Item",#AlootSet3ID23 != 0? "Item ID "+#AlootSet3ID23+" - ("+getitemname(#AlootSet3ID23)+")": "Add Item",#AlootSet3ID24 != 0? "Item ID "+#AlootSet3ID24+" - ("+getitemname(#AlootSet3ID24)+")": "Add Item",#AlootSet3ID25 != 0? "Item ID "+#AlootSet3ID25+" - ("+getitemname(#AlootSet3ID25)+")": "Add Item" ))

Share this post


Link to post
Share on other sites
  • 0

You can also do something like this, to make it smaller.

 

for (.@i=1; .@i< 26; .@i++){	.@menu$ = .@menu$ +""+ (getd("#AlootSet3ID"+.@i) != 0)?"Item ID "+getd("#AlootSet3ID"+.@i)+" - ("+getitemname(getd("#AlootSet3ID"+.@i))+")":"Add Item";} 

 

and followed by

switch(select(.@menu$)){	//Do something here.}

or

@option = select(.@menu$);//Do Something with @option, @option=1, if selected 1st option and so on.

Share this post


Link to post
Share on other sites
  • 0

If I use

for (.@i=1; .@i< 26; .@i++){	.@menu$ = .@menu$ +""+ (getd("#AlootSet3ID"+.@i) != 0)?"Item ID "+getd("#AlootSet3ID"+.@i)+" - ("+getitemname(getd("#AlootSet3ID"+.@i))+")":"Add Item";} 

and

switch(select(.@menu$)){	//Do something here.}

can I change it to be somehting like..

 

 

.@menu$ = .@menu$ +""+ (getd("#AlootSet"+.@s+"ID"+.@i) != 0)?"Item ID "+getd("#AlootSet"+.@s+"ID"+.@i)+" - ("+getitemname(getd("#AlootSet"+.@s+"ID"+.@i))+")":"Add Item";

and

switch(select(.@menu$)){

will that let me then later (since there's 6 sets and 25 items per set) do..

 

		mes .NPCName$;		mes "Please input the item ID for what you want to autoloot.";		mes "Enter 0 if you wish to leave this option blank.";		input @input;		if (@input == 0)		{		next;		mes .NPCName$;		mes "Alright, deleted!";		set #AlootSet.@sID.@i,0;		next;		goto L_EasyMode;		close;		} else {		if(getiteminfo(@input,0) == -1)		{		next;		mes .NPCName$;		mes "Sorry, this is not a valid Item ID";		mes "Please try again.";		next;		goto L_EasyMode;		next;		} else {		next;		mes .NPCName$;		mes "Item ID "+@input+" ("+getitemname(@input)+") has been updated on your list.";		set #AlootSet+.@s+ID+.@i,@input;		next;		goto L_EasyMode;		}

 

Something like that, so I can just make one string for all 6 sets and 25 items per set?

 

Entire Code for this section.

 

 

 

L_EasyMode:	  mes .NPCName$;	  mes "Let's edit what's listed in this set.";	  mes "You can Delete any item by entering 0.";	  mes "Or edit the item ID by entering it in place of an existing one.";	  for (.@i=1; .@i< 26; .@i++ && .@s=1; .@s<7; .@s++){    .@menu$ = .@menu$ +""+ (getd("#AlootSet"+.@s+"ID"+.@i) != 0)?"Item ID "+getd("#AlootSet"+.@s+"ID"+.@i)+" - ("+getitemname(getd("#AlootSet"+.@s+"ID"+.@i))+")":"Add Item";}	   switch(select(.@menu$)){	   case 1:	   next;mes .NPCName$;		mes "Please input the item ID for what you want to autoloot.";		mes "Enter 0 if you wish to leave this option blank.";		input @input;		if (@input == 0)		{		next;		mes .NPCName$;		mes "Alright, deleted!";		set #AlootSet.@sID.@i,0;		next;		goto L_EasyMode;		close;		} else {		if(getiteminfo(@input,0) == -1)		{		next;		mes .NPCName$;		mes "Sorry, this is not a valid Item ID";		mes "Please try again.";		next;		goto L_EasyMode;		next;		} else {		next;		mes .NPCName$;		mes "Item ID "+@input+" ("+getitemname(@input)+") has been updated on your list.";		set #AlootSet+.@s+ID+.@i,@input;		next;		goto L_EasyMode;		}}

 

 

 

Thank you in advance

 

 

Edit:

Or rather...

when the menu for what set they want to edit comes up, put the

for (.@s=1; .@s< 7; .@i++){
like,

 

mes .NPCName$;   mes "Alright, let's edit an existing set!";   mes "What set do you want to edit?";   mes "Empty/Unused Sets are shown with "Nothing" and can't be edited.";   if (#LootSet1$ == "") { set @menu$[1], "Nothing"; } else { set @menu$[1], #LootSet1$; }   if (#LootSet2$ == "") { set @menu$[2], "Nothing"; } else { set @menu$[2], #LootSet2$; }   if (#LootSet3$ == "") { set @menu$[3], "Nothing"; } else { set @menu$[3], #LootSet3$; }   if (#LootSet4$ == "") { set @menu$[4], "Nothing"; } else { set @menu$[4], #LootSet4$; }   if (#LootSet5$ == "") { set @menu$[5], "Nothing"; } else { set @menu$[5], #LootSet5$; }   if (#LootSet6$ == "") { set @menu$[6], "Nothing"; } else { set @menu$[6], #LootSet6$; }   next;   for (.@s=1; .@s<7; .@s++){   switch(select(@menu$[1],@menu$[2],@menu$[3],@menu$[4],@menu$[5],@menu$[6]))   {

Edited by RiverStyx

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

×
×
  • Create New...

Important Information

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