Jump to content

Question

Posted (edited)

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(.@a,.@a+1)<=.e_len) {
	if(getequipid(.@a)>-1) {
		if(getiteminfo(getequipid(.@a),2)!=4) {
		    set .@menu$, .@menu$+.eqp$[.@a-1]+"- [^0000FF"+getitemname(getequipid(.@a))+"^000000]:";
		    set(.@menu[getarraysize(.@menu)],.@a);
		}
	}
}

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

6 answers to this question

Recommended Posts

Posted
	if (getequipid(.@a) > -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.

Posted


set .@menu$, "";

for(set .@i,0; .@i < getarraysize(.eqp$); set .@i, .@i +1){

if(.eqp$[.@i] != "") {

set .@menu$, .@menu$ + "- [^0000FF"+getitemname(getequipid(.@i))+"^000000]";

set .@menu$, .@menu$ + ":";

}

}

set @selected,select(.@menu$)-1;

Posted
	set .@menu$, "";
	for(set .@i,0; .@i < getarraysize(.eqp$); set .@i, .@i +1){
		if(.eqp$[.@i] != "") {
			set .@menu$, .@menu$ + "- [^0000FF"+getitemname(getequipid(.@i))+"^000000]";
			set .@menu$, .@menu$ + ":";
		}
	}		
	set @selected,select(.@menu$)-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?

Posted

 

	set .@menu$, "";
	for(set .@i,0; .@i < getarraysize(.eqp$); set .@i, .@i +1){
		if(.eqp$[.@i] != "") {
			set .@menu$, .@menu$ + "- [^0000FF"+getitemname(getequipid(.@i))+"^000000]";
			set .@menu$, .@menu$ + ":";
		}
	}		
	set @selected,select(.@menu$)-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;}
Posted (edited)

 

	if (getequipid(.@a) > -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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...