Help with checking value of multiple variables

Not too long ago @Shaz helped me with a script to check if all switches in a group were set to off which was very helpful, but now I am hoping there is a similar script to determine if any of a set of variables are greater than, or equal to 3.

To make sure I'm being clear, I want a conditional branch to activate if any 1 of 8 variables are greater than or equal to 3.

This was the script to check for the 8 switches !([1,2,3,4,5,6,7,8].any?{|sw| $game_switches[sw]})
Is there something similar for value checks on a set of variables?
Sure.

[1,2,3,4,5,6,7,8].any?{|var| $game_variables[var] >= 3}

Where 1,2,3,4,5,6,7,8 are the IDs of the variables you want to check.
Sweet, I will test it out to make sure it works in what I am trying to do. Thanks!

One adjustment to it if possible, could the script check to see if any 2 out of the 8 are greater than or equal to 3?
[1,2,3,4,5,6,7,8].select{|var| $game_variables[var] >= 3}.size == 2
Awesome! I'm assuming I can just adjust the ==3 to >=3 in case any 2 variables are greater than or equal to 3 rather than only being equal to.

Thanks Trihan! I will test these out tomorrow and let you know if I run into any issues.
Sorry, forgot to change that back to >= in my test project. Yeah, that's what it should have been, I'll edit the post.
@Trihan - The check if any of the variables are greater than or equal to 3 is working fine for a conditional branch that displays text if the condition is met and when I change the variables to all being below 3 then the text does not display, but the script to test if 2 or more of the variables are greater than or equal to 3 is never returning a result for me. Is there any additional syntax I need to add like parenthesis or something?

*EDIT* Ahh! I needed to change the 'size==2' into 'size>=2' since I wanted to check whenever at least 2 of the variables are 3 or greater and now it seems to work exactly as I want. (and I figured this out 30 seconds after posting, of course)

Thanks again Trihan!
No worries, glad it worked for you! Let me know if you need anything else. 🙂 As your original query has been answered, you should report your thread to a mod and request that it be closed.
Thread closed IgnoreMe

Original thread: https://forums.rpgmakerweb.com/threads/help-with-checking-value-of-multiple-variables.75264/