Way to select multiple numbers for variables in a conditional branch?

So in my game there is a shop that sells random items, weapons, and armor. I already have a special script running that allows this randomized shop to work. Here it is.
var id = x, type = y, min = z, max = a, inv = b; var array = [], temp = [], rand; for(i = 0; i < inv; i++) { do { rand = Math.floor(Math.random()*(max-min+1)+min); } while (temp.indexOf(rand) > -1); temp[i] = rand; array[i] = [type, rand, 0]; } if(Array.isArray($gameVariables.value(id))) var array = $gameVariables.value(id).concat(array); $gameVariables.setValue(id, array);

"Var ID" determines which variable the random shop will use, type determines which type of item is chosen, (1 for items, 2 for weapons, 3 for armor) min and max are the lowest and highest IDs of a weapon or armor that you want to randomize, and inv determines if you can sell or not. (0 = Allow, 1 = Deny) Seems simple enough, right?

However, in all three of the categories, different types of items, weapons, and armor are divided by blank items that are named "-----------------------" and used as dividers. I do not want the random selection script to choose any of these blank items. I know that I can make a loop and then put in a conditional branch for every ID I don't want chosen and if that ID I don't want is chosen the loop repeats until I get the result I wanted, but that will take ages as for some of the categories there are almost 100 blank items and I don't want to make an conditional branch for every one! Is there a way to have conditional branches be able to select multiple variable numbers (not the actual variables, just the numbers like 2, 5, 7, ect) at once out of a pool of numbers? An example of this would be a conditional branch that says "If variable x = 2, 5, 7, 12, 18, 24, 33...or 211, then play result 1. If else, play result 2." Another possibility would be to alter the command to exclude certain IDs when randomly choosing numbers. Is there any was to acomplish this in base MV or is there a specific plugin I'll need? Thanks.

-KrimsonKatt
Hi there!
I have to be honest with you, I didn't get all your trouble right.
But with my tired brain, I can answer at least one of your questions:
However, in all three of the categories, different types of items, weapons, and armor are divided by blank items that are named "-----------------------" and used as dividers. I do not want the random selection script to choose any of these blank items.
For that, before you select your items you can make a new array for each data with only the items you want.
You can do this two ways:

1 - Setting a specific note tag on the note field of the items.
Spoiler
1613535186750.png


Then you can use the filter method to make a new array, getting only the items that do not contain the "<NotValid>" tag:
1613535307314.png

So you check if an item exists in the $dataItems(Is necessary because of the index 0 that is null) and also check if the item does not have the <NotValid> note tag.

After that, you can use the method you use to get a random number id from this new array.

2 - The second way
Spoiler
Is similar to the first, you use a filter method to get all the items you want, but you can specify the items you don't want cheking it's names:
JavaScript:
const validItems = $dataItems.filter(item =>{
if(!item) return false
const isNotSeparator = item.name !== '-----------------'
const isNotBlankItem = item.name !== ''

return item && isNotSeparator && isNotBlankItem

})

After you set all the valid items in the new arrays, you don't need to worry about the random select script.
@Eliaquim I like the idea of using the notetags to determine which items are not included. However, I don't actually know how to determine the code for this sort of stuff. I know pretty much zero javascript and just copied the code from somewhere else, so most of what you said is pretty much gibberish to me. However, I did get that I need to do a second script call before the first one that prevents the second script call from calling certain items with a note tag attached. Is this correct? If so, can you please link me the script call that I can use for my project? The code your provided in your post was an image file, so I couldn't copy and paste it into my game. Thanks!
I suppose it could be done via very long/complex "or" statement?
JavaScript:
if x == 2 || x == 5 || x == 7 || x == 12 || x == 18 || x == 24 || x == 33 || <stuff between 33 and 211> || x == 211
{
  # Do whatever "play result 1" would do.
}
However, setting up a note-tag might be the overall better move, if you really have hundreds of "blank" items. I'd be somewhat partial to the first solution presented here...
JavaScript:
const validItems = $dataItems.fliter(item => item && !item.meta.NotValid)
...but, that's just me.

*Edit: To be fair, I'm certainly more an Ace user than anything else, so you can take what I say with a grain of salt.
@KrimsonKatt
Ohh I got it. I was thinking you already had a javascript background.
So you set the note tags on the items/weapons/armors that you do not want to include in your shop.
After that, you get all of them:

(You can replace const with var too)
JavaScript:
const validItems = $dataItems.filter(item => item && !item.meta.NotValid)
const validWeapons = $dataWeapons.filter(weapon => weapon && !weapon.meta.NotValid)
const validArmors = $dataArmors.filter(armor => armor && !armor.meta.NotValid)

I wish I have to say more, but I'm not understanding the code you posted first. SO I don't know exactly how do you will put this validItems variables on your code.
If you can wait, I will do a plugin that lets you do that. But can't say when.
@Eliaquim How long will I be until that random shop plugin releases? I can wait one or two months, max.
Well, one or two months is nice!
I'm sure will release it before that 🙂
Follow me here and you will see when I released it 🙂

Original thread: https://forums.rpgmakerweb.com/threads/way-to-select-multiple-numbers-for-variables-in-a-conditional-branch.133484/