RiverStyx 0 Posted July 8, 2014 (edited) So, essentially I want to check some things out, can I use the same label for 2 callsubs with a different number of getargs? case 1: callsub Create2,7136,7129,713,929,7137;case 2: callsub Create2,7139,7137,713,950,970,1044; ..... later on..... ...... if ((countitem(getarg(1)) >= @input) && (countitem(getarg(2)) >= @input) && (countitem(getarg(3)) >= @input) && (countitem(getarg(4)) >= @input) && (countitem(getarg(5)) >= @input) && (countitem(getarg(6)) >= @input) && (countitem(getarg(7)) < @input)) { So if only 5 getargs are set with a variable, is there a way to use the if function to check? or is it just going to be a bunch of } else { within an if function?(not sure if it's even doable.. lol) thanks in advance! Edited July 9, 2014 by RiverStyx Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted July 9, 2014 Okay, thanks a ton with that, and as an additional question, is there a way to make it let you know what arguments failed the check? (let the player know) for (.@i=0; .@i<getargcount(); .@i++){ if (countitem(getarg(.@i))<@input){@error = 1;} mes "You Need ["+countitem(getarg(.@i))+"/"+@input+"] "+getitemname(getarg(.@i));}if (@error==1){ mes "You do not have enough items"; close;}//Do anything here This way, it would show "You Need [x/y] ItemName" for every item required. 1 RiverStyx reacted to this Quote Share this post Link to post Share on other sites
0 Dastgir 1246 Posted July 9, 2014 getargcount() Above function returns the number of arguments passed to a function via callfunc, or to callsub. if you want to pass all getarg() through same condition, you can use for loop in the Create2 Label: for (.@i=0; .@i<getargcount(); .@i++){ if (countitem(getarg(.@i))<@input){@error = 1;}}if (@error==1){ mes "You do not have enough items"; close;}//Do anything here Quote Share this post Link to post Share on other sites
0 RiverStyx 0 Posted July 9, 2014 Okay, thanks a ton with that, and as an additional question, is there a way to make it let you know what arguments failed the check? (let the player know) Quote Share this post Link to post Share on other sites
0 RiverStyx 0 Posted July 9, 2014 You're a beautiful person, sir. I appreciate your insight. Quote Share this post Link to post Share on other sites
So, essentially I want to check some things out, can I use the same label for 2 callsubs with a different number of getargs?
.....
later on.....
......
So if only 5 getargs are set with a variable, is there a way to use the if function to check? or is it just going to be a bunch of } else { within an if function?(not sure if it's even doable.. lol)
thanks in advance!
Edited by RiverStyxShare this post
Link to post
Share on other sites