increment a variable via events?

I have an idea where you need to press a switch to open switch blocks, but it also makes a monster chase you until you get to the next room. i came up with the idea to use a variable which opens all blocks until you get past a certain point and then have to do it again in another place. how should I go about this? thanks for any tips given.
You could have a switch dependent on a variable's value but it seems more efficient to cut out the variable entirely and just have everything you want to happen dependent on the switch being on.
If you don't even have an idea how to start with this, you might want to do some more tutorials on events, variables, and switches.

Or try to explain yourself more explicitly, I'm not sure what a "switch block" means. I agree with AquaEcho that this sounds like something you'd just do with a single switch.
alright, what i basically want to do is that there is a door blocking your way made up of several blocks which are raised when you press a switch, and the switch next to it, but behind you is a monster which also activates when the switch is pressed and keeps chasing you until you run to the next room. how should i go about using this switch method then?
So you need to touch two switches to open a door, and touching any one of them activates the monster?

Have both switches set themselves to Self Switch A on touch, and be able to remotely toggle the self switch of the monster using the following script command:
$gameSelfSwitches.setValue([mapNumber, monsterEventNumber, 'A'], true);
With the monster active page being Page A

Then your door can check
If: Script: $gameSelfSwitches.Value([$gameMap._mapId, Switch1EventID, 'A'] && [$gameMap._mapId, Switch2EventID, 'A'])
Set Self Switch of the Door to A which changes it to the open position.
It might not be efficient for you to get into script calls for self switches for this - if you have several blocks for the door and a monster that are all activated by the switch...that's what global switches are for.

The button just has an event command to turn a switch on. All of the blocks in the doorway have a second, blank page with the condition of that switch.

The monster event has a blank first page and a second page with the monster and the autonomous movement command approach player, also set to that same switch.
The button just has an event command to turn a switch on. All of the blocks in the doorway have a second, blank page with the condition of that switch.
The problem is the player needs to touch both switches to open all the doors. Your solution opens the door if just one switch is touched.
So you need to touch two switches to open a door, and touching any one of them activates the monster?

Have both switches set themselves to Self Switch A on touch, and be able to remotely toggle the self switch of the monster using the following script command:
$gameSelfSwitches.setValue([mapNumber, monsterEventNumber, 'A'], true);
With the monster active page being Page A

Then your door can check
If: Script: $gameSelfSwitches.Value([$gameMap._mapId, Switch1EventID, 'A'] && [$gameMap._mapId, Switch2EventID, 'A'])
Set Self Switch of the Door to A which changes it to the open position.
i think there was a bit of miscommunication, there is only one switch, also i have found a simpler solution where both the door and the monster have two states that trigger when the switch is pressed and then it gets turned off via the events that move you to the next room. tl:dr: it works now, thanks
Oh, ok. I just read this as two switches needing to be pressed
several blocks which are raised when you press a switch, and the switch next to it,

Original thread: https://forums.rpgmakerweb.com/threads/increment-a-variable-via-events.157380/