Jump to content
  • 0

Using loop to check item HELP


Question

Posted

How to check items based from a list in an array? Help please. I'm noob on using loops.

I tried to make one but it doesn't detect the item from the list.

 

I need to match the equipped item from any itemid on the list for the script to went thru.

but my script always trigger != even the item equipped is in the list.

for( .@i = 0; .@i < getarraysize(.list); .@i++ ){
    if(getequipid(.@part) != .list[.@i]){
    mes .npcname$;
    mes "Sorry but I can't replicate this item. Please pick one from the list.";
    emotion e_sry;
    close;
    }
}
mes .npcname$;
mes "I can replicate this item.";

List of items that can be replcated:

setarray .list[0],2383,2541,2410,2629,2630;

Thanks in advance!

2 answers to this question

Recommended Posts

Posted


for( .@i = 0; .@i < getarraysize(.list); .@i++ ){

if(getequipid(.@part) == .list[.@i]){

mes .npcname$;

mes "I can replicate this item.";

                close;

}

}

mes .npcname$;

mes "Sorry but I can't replicate this item. Please pick one from the list.";

emotion e_sry;

close;

Posted (edited)
for( .@i = 0; .@i < getarraysize(.list); .@i++ ){
    if(getequipid(.@part) == .list[.@i]){
		mes .npcname$;
		mes "I can replicate this item.";
                close;
    }
}
mes .npcname$;
mes "Sorry but I can't replicate this item. Please pick one from the list.";
emotion e_sry;
close;

 

Emistry thanks for this.

Anyway I tried your script but it's the same. It always say Sorry but I can't replicate. . . . . . .

 

EDIT:

I tried to equip all those in the array. but only the first one (2383) can went thru.. the rest cannot.

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