Variable Batch Comparing

I'm trying to use a Conditional Branch to compare a Variable to a Batch of Variables to check if the a variable is within the batch of variables.


I can't seem to get it quite right. Is there a way to do this?


This is what I've been tinkering with, but it doesn't seem to be working.


The line that gets cut off in the Conditional Branch is:


$game_variables[226] == $game_variables[221..225]


Is there maybe a script call for this or another way using events that I'm not doing right?

VarBatch.jpg
Your code doesn't work because $game_variables[221..225] returns an array of the values from variables 221 to 225. If you compare the value of variable 226 with that, you ask if a number is the same as an array - which will never be the case.


Instead you have to check if the value of variable 226 is included somewhere in the other variables. The script for that looks like this:


$game_variables[221..225].include?($game_variables[226])
ack! I tried ".include?" but in the wrong order!


Thx so much!

Original thread: https://forums.rpgmakerweb.com/threads/variable-batch-comparing.73773/