integral Posted March 17, 2013 Posted March 17, 2013 How do I check if a value that is randomized is equal to an element in an array? For example, monster and mvp IDs. setarray .mvp[0],1038,1039,1046; Then I will randomize a number. set .monster, 1000+rand(1,1308); Then let's say, .monster == 1038 Then there will be a comparison. if (.monster == .mvp ) { mes "That is an MVP"; } else { //If they are not equal, proceed mes "That is a normal monster"; } Thanks a lot. Quote
Emistry Posted March 17, 2013 Posted March 17, 2013 like this ? for( .@i = 0; .@i < getarraysize( .mvp ); .@i++ ) if( .monster == .mvp[.@i] ){ mes "It's MVP.."; close; } mes "It's not MVP."; close; 1 Quote
integral Posted March 17, 2013 Author Posted March 17, 2013 like this ? for( .@i = 0; .@i < getarraysize( .mvp ); .@i++ ) if( .monster == .mvp[.@i] ){ mes "It's MVP.."; close; } mes "It's not MVP."; close; I see, using the for loop in order to check each and every element. Thank you. Quote
Question
integral
How do I check if a value that is randomized is equal to an element in an array?
For example, monster and mvp IDs.
Then I will randomize a number.
Then let's say,
Then there will be a comparison.
Thanks a lot.
2 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.