Jump to content
  • 0
Lord Ganja

Dynamic Menu help

Question

Hi. Im using this dynamic menu for my custom enchantment. But it seems getting debugs whenever it runs into this script. I can't seem to figure out whats the problem.

mes .npc$;
mes "Please select an equipment from the menu."; next;
while(set([email protected],[email protected]+1)<=.e_len) {
	if(getequipid([email protected])>-1) {
		if(getiteminfo(getequipid([email protected]),2)!=4) {
		    set [email protected]$, [email protected]$+.eqp$[[email protected]]+"- [^0000FF"+getitemname(getequipid([email protected]))+"^000000]:";
		    set([email protected][getarraysize([email protected])],[email protected]);
		}
	}
}

OnInit:
setarray .eqp$, "Upper Headgear", "Armor", "Left Hand", "Right Hand", "Garment","Shoes", "Accessory1", "Accessory2", "Mid Headgear", "Low Headgear";
set      .e_len , getarraysize(.eqp$);

Debugs:

[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
[Debug]: Source (NPC): Ganja Runes#1 at turbo_room (76,110)
Edited by Lord Ganja
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

	if (getequipid([email protected]) > -1) {

For checking if they have an item equipped in that slot, you should use getequipisequiped.

Even though 'getequipid' returns -1 if no item is equipped, that is considered a failure of the script command and that's why the map-server shows the debug message.

Link to comment
Share on other sites


set [email protected]$, "";

for(set [email protected],0; [email protected] < getarraysize(.eqp$); set [email protected], [email protected] +1){

if(.eqp$[[email protected]] != "") {

set [email protected]$, [email protected]$ + "- [^0000FF"+getitemname(getequipid([email protected]))+"^000000]";

set [email protected]$, [email protected]$ + ":";

}

}

set @selected,select([email protected]$)-1;

Link to comment
Share on other sites

	set [email protected]$, "";
	for(set [email protected],0; [email protected] < getarraysize(.eqp$); set [email protected], [email protected] +1){
		if(.eqp$[[email protected]] != "") {
			set [email protected]$, [email protected]$ + "- [^0000FF"+getitemname(getequipid([email protected]))+"^000000]";
			set [email protected]$, [email protected]$ + ":";
		}
	}		
	set @selected,select([email protected]$)-1;

 

I forgot to mention. Weapons are excluded. It shouldn't put weapons on the menu if weapon is equipped. How would I do that?

Link to comment
Share on other sites

 

	set [email protected]$, "";
	for(set [email protected],0; [email protected] < getarraysize(.eqp$); set [email protected], [email protected] +1){
		if(.eqp$[[email protected]] != "") {
			set [email protected]$, [email protected]$ + "- [^0000FF"+getitemname(getequipid([email protected]))+"^000000]";
			set [email protected]$, [email protected]$ + ":";
		}
	}		
	set @selected,select([email protected]$)-1;

 

I forgot to mention. Weapons are excluded. It shouldn't put weapons on the menu if weapon is equipped. How would I do that?

 

Oh, sorry i don't know ;) you can add check

 if (getequipisequiped(EQI_HAND_L)) {mes "uneqip weapon first"; close;}
Link to comment
Share on other sites

 

	if (getequipid([email protected]) > -1) {

For checking if they have an item equipped in that slot, you should use getequipisequiped.

Even though 'getequipid' returns -1 if no item is equipped, that is considered a failure of the script command and that's why the map-server shows the debug message.

 

What should I use so it won't display weapons on the menu, even if a weapon is equipped?

 

EDIT:

Nvmind, figured it out. Thanks for your help :)

Edited by Lord Ganja
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...

Important Information

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