Jump to content
  • 0
Jedzkie

Help on script

Question

hi! how can i set a black list here in my script? i copied the black list from disguise event, then i transfer it to my script.

 

i set my black list as an array.

 

i try to put if( .@disguise == .@blacklist[0] ) but its not working. can someone help me.

 

here's my script:

 

 

				mes "[ ^ffa500Master of Disguise^000000 ]";				mes "Okay then, please write the NUMBER ID of the Monster or NPC you would like to be Disguised as.";				next;				input .@disguise,0;								if( .@disguise == 0 ) || ( .@disguise <= 1001 ) || ( .@disguise >= 2082 ) || ( .@disguise == .@blacklist[0] ){				goto choose_one;				close;				}				else {				disguise (.@disguise);				delitem 21000,1;				close;				}

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

The problem right off the bat is how you're writing the expression for your if statement. You can't separate expressions in parentheses and compare them that way; you'd have to have another set of parentheses enclosing the entire expression. The proper way to write your (improper) check would be:

 

if(.@disguise == 0 || .@disguise < 1001 || .@disguise > 2082 || .@disguise == .@blacklist[0])

 

Now, this is still wrong because the blacklist isn't being checked the way you want it to. Here, you should use a loop and a variable to keep count of incrementation. By this, I mean changing .blacklist[0] into .blacklist[.@i].

 

Replace this:

if( .@disguise == 0 ) || ( .@disguise <= 1001 ) || ( .@disguise >= 2082 ) || ( .@disguise == .@blacklist[0] ){goto choose_one;close;}

 

With this:

for(.@i = 0; .@i < getarraysize(.blacklist); .@i++){    if(.@disguise == 0 || .@disguise < 1001 || .@disguise > 2082 || .@disguise == .@blacklist[.@i])    {        mes "[ ^ffa500Master of Disguise^000000 ]";        mes "Sorry, the ID you chose is either unavailable or blacklisted.";        close;    }}

 

Here, we're enclosing our if statement inside of a for loop. What this for loop does is check each value of your .blacklist array until it has gone through each and every value.

 

Fill your array with monster IDs, like this:

.blacklist[0], 1001, 1002, 1003, 1004, 1005;

 

Keep in mind that you can only store up to 128 values in an array (though if this has changed, someone please correct me).

 

For more on the if statement, loops, and arrays, please refer to the Wiki; it's quite useful for referencing.

 

http://herc.ws/wiki/If

http://herc.ws/wiki/Loops

http://herc.ws/wiki/Array

Edited by Via

Share this post


Link to post
Share on other sites
  • 0

i was about to answer, but your answer was perfect :D

Share this post


Link to post
Share on other sites
  • 0

off topic though

 

arrays are 128, but a small hack is that it can use negative values too :P

-127 to 127.

 

but i think there is some secret plans to make the arrays unlimited, shhh, secret

Share this post


Link to post
Share on other sites
  • 0

off topic though

 

arrays are 128, but a small hack is that it can use negative values too :P

-128 to 128.

 

but i think there is some secret plans to make the arrays unlimited, shhh, secret

 

Oh wow. I hadn't quite thought of using negative values. While 256-ish is great, unlimited arrays would be amazing. *__*

Share this post


Link to post
Share on other sites
  • 0

Thank you both of you! :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

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