Jump to content
  • 0

Help on dynamic menu


Lil Troll

Question


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Hi guys/gals! I really want to know how to make enable and disable menu (switch,select,menu[commands]) if you dont have a certain item requirements, or if statement. For example.

 

[Menu 1] // Clickable you you have item 501
[Menu 2] // Clickable you you have item 501
[Menu 3] // Clickable you you have item 501
[Menu 4] // Clickable you you have item 501

or

[Menu 1] // Clickable if statement = true
[Menu 2] // Clickable if statement = true
[Menu 3] // Clickable if statement = true
[Menu 4] // Clickable if statement = true

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

There are a few different ways of doing a dynamic menu.

 

set .@req$, "|1599|1201|"; //Items required.
setarray .@eq$,
	"Upper Headear", "Armor" , "Left hand"  , "Right hand"     ,  "Garment",
	"Footgear", "Accessory 1", "Accessory 2", "Middle Headgear", "Lower Headgear";
set .@len, getarraysize(.@eq$); //Array size.
set .@menu$, implode(.@eq$,":"); //Menu

npctalk "Where is the item equipped?";
select(.@menu$); //Setting the choice @menu.
set .@eq_itm, getequipid(@menu); //Equipped slot to ID.

if(!compare(.@req$,"|"+.@eq_itm+"|")) //Comparing Equipped item to required items!
	npctalk "No that's not the item!";
else npctalk "Awesome you got it!";
end;

This is an example where the menu isn't so dynamic but your options are limited to one of multiple required items without loops etc.

 

 

setarray .@con, 501, 502 ,503, 504, 505; //Required List.
set      .@len, getarraysize(.@con); //Length of list.

while(.@i++-1<.@len)
	set .@menu$, getitemname(.@con[.@i-1])+":"; //Creating the menu.
	
set .@sel, select(.@menu$)-1; //Select from the menu and reduce the selection by one so it will match our array.

if(!countitem(.@con[.@sel])) //Get the ID from our array with the players selection, and use it to see if the item exists.
	npctalk "You don't have "+getitemname(.@con[.@sel])+".";
else
	getitem(.@con[.@sel],1);
end;

In this example you match the array with the selected menu... If the menu and the array are the same we can grab and use items from the array as our players selection.

 


 

If you mean using case conditions they really aren't very flexible, but they do work well for database type situations where the information can be individually set for each item.

 

function	script	Monster_DB	{
	switch(getarg(0)){
		case 1002:
			switch(getarg(1)){
				// Keep in mind these are precents overall so 20% is actually lower while 140% is actually 40% higher.
				// Where 200% is double... It's like saying 2*400=800.
				case 0: // Heal Item Rate (Healing Items)
					return 20; // 20% for  healing items.
				
				case 2: case 7: case 11: case 18: // Uasable Item Rate (Anything Usable that doesn't heal)
					return 100; // 100% for healing items.
					
				case 3: // Common Item Rate (ETC)
					return 200; //200% more for Common Items.
				
				case 4: case 5: case 8: case 10: // Equip Item Rate (Ammo, Pet Equip, Weapon, Armor)
					return 140; // 140% more for equip items.
				
				case 6: // Card Item Rate (Card)
					return 200; // 110% more for cards.
			}
		case 1003:
		case 1004:
		case 1005:
		//...to add new monsters simply do as I've done.
	}
}

Where 1002(getarg(0)) is the mob ID and number 0-6(getarg(1)) are dropped item types.

 

You can view the full script here.

http://code.google.com/p/ea-addicts/downloads/detail?name=dropemulator.txt&can=2&q=

 

I hope this helps.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

Like this?

prontera,150,150,0    script    Sample    100,{
    .@check = ( countitem(501) ? 1 : 0 );
    if ( .@check ) 
        select("1:2:3:4");
    else end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Is this correct sir?

 

prontera,150,150,0    script    Sample    100,{
    .@check = ( countitem(501) ? 1 : 0 );
    .@check1 = ( countitem (502) ? 2 : 0 );
    .@check2 = ( countitem(503) ? 3 :0 );
    .@check3 = ( countitem(504) ? 4: 0);
    if ( .@check && .@check1 && .@check2 && .@check3 )
        select("1:2:3:4");
    else end;
}


OMG Thanks for the fast reply sir's. :D
@sir Patskie and @sir Skorm Super thanks! My problem will be solved in easiest manner thanks so much!!!

 

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Is this correct sir?

 

prontera,150,150,0    script    Sample    100,{
    .@check = ( countitem(501) ? 1 : 0 );
    .@check1 = ( countitem (502) ? 2 : 0 );
    .@check2 = ( countitem(503) ? 3 :0 );
    .@check3 = ( countitem(504) ? 4: 0);
    if ( .@check && .@check1 && .@check2 && .@check3 )
        select("1:2:3:4");
    else end;
}

 

If you're just trying to check if the player has all those items that would work.

 


 

You could also do something like this.

 

prontera,150,150,0	script	Sample	100,{
	setarray .@items, 501, 502, 503, 504;
	set .@len, getarraysize(.@items);
	
	while(.@i++-1<.@len)
		if(!countitem(.@items[.@i-1]))
			break;

	if (.@i==.@len)
		npctalk "You have all the items!";

	end;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Wow thanks again sir! This topic is very informative. I love you all! :D

Link to comment
Share on other sites


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

you mean these ?


.@i = rand( 4 );
select(
	( .@i == 0 )?"TRUE":"",
	( .@i == 1 )?"TRUE":"",
	( .@i == 2 )?"TRUE":"",
	( .@i == 3 )?"TRUE":""
);
  • Upvote 2
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  38
  • Topics Per Day:  0.01
  • Content Count:  276
  • Reputation:   24
  • Joined:  07/06/13
  • Last Seen:  

Yes sir emistry, ill add that to my dynamic menu notes thanks! :D

Edited by Lil Troll
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...