Is there a way to check if a range of switches are on other than nesting a conditional branch?

In my game, after you defeat Tagänogók (Good luck, it's a rigorous hour long difficult fight), the party meets up at Damian's house and the party discusses Tagänogók's defeat and it is suggested that they go to every town in the Argentina World and inform townsfolks of Tagänogók's defeat.

There is a total of 20 people to talk to (there are more townsfolks than that in the Argentina World but you only need to speak to 20 of those) and I am using a full set of 20 switches to keep track of who the player has talked to.

I know that I can nest a conditional branch the entire set of 20 switches but I thought I would check to see if there is a way to check a range with a single option.

Is there some kind of script call I can put into the conditional branch to check all 20 at once?
Why not check whether a NPC has been talked to using self-switches, and then increment a variable of "talked to this many people"? Or are NPCs supposed to respond to other NPCs having been talked to? Seems unnecessary to use that many switch slots for this purpose otherwise. 😴
There is a script call to check if all 20 are on (assuming the switch IDs are sequential--you'll need a slightly different approach if they aren't):

(1..20).to_a.all? { |switch| $game_switches[switch] }

But why not use a variable for this and add 1 to it when you talk to an NPC instead?
But why not use a variable for this and add 1 to it when you talk to an NPC instead?
That will mess things up if the player speaks to NPCs more than once.

Switches are sequential as I am using an entire set. (Game groups them into groups of 20s)
That's why I suggested using self-switches, so the variable can only increment once. I did assume you could talk to them in any order, though.
That's why I suggested using self-switches, so the variable can only increment once. I did assume you could talk to them in any order, though.


Dammit, ya ninja'd me lmao
Dammit, ya ninja'd me lmao
Yeah, I wasn't suggesting just doing that by itself, it would be in conjunction with turning on a self switch when you've talked to an NPC that prevents the variable going up again, which I assumed you knew how to do. ^_^
If I used self switches, I would have to duplicate the page just for the NPCs to say the same thing but without the switch. Using normal switches keeps things tidy. Besides, when it comes time to turn the switch on that progresses the next part of MSQ when you go back to the Kalamazoo World, all those NPCs will have different dialogue and some already have 10 pages. I am trying to keep it as minimal as possible.

Edit: Your self switch suggestion is still a good takeaway in case another scenario comes up that isn't so busy or I do want something else to be said later on.
If you also use conditional branches to check if said self-switch is on, I think you can put it on the same page, no need to make a new one. If anything, using switches unnecessarily would seem untidy to me, but that's just me I guess.
Can't you just use a conditional at the end of the original page that checks whether the self switch is on and increment the variable if it isn't?

Page conditions aren't the only place a self switch is useful for.
I would have to duplicate the page just for the NPCs to say the same thing but without the switch.
and that's normal eventing. This is how you make a game.
But if you have events that have more than 3 or 4 pages then you are doing a lot of variation, I just wonder if it's optimized.
You made your game so I can't say if that's a good way to do it or not.

There is another way to hold the data in a variable (array), but then you need a different way to check the conditions, so I guess you should carry on with the switches.
There isn't really any need to mess around with extra pages, repeat code, or arrays. Just do this and the problem is solved, very uncomplicated.

1692884551657.png

Except you know, do it in VX, not MV.
Y
There isn't really any need to mess around with extra pages, repeat code, or arrays. Just do this and the problem is solved, very uncomplicated.

View attachment 274351
Except you know, do it in VX, not MV.
Yep, this is exactly what I was suggesting.
If I used self switches, I would have to duplicate the page just for the NPCs to say the same thing but without the switch.

I guess? I always try to have my NPCs cycle through two or three things anyway.

Original thread: https://forums.rpgmakerweb.com/threads/is-there-a-way-to-check-if-a-range-of-switches-are-on-other-than-nesting-a-conditional-branch.160581/