Got a question about how to use multiple event pages.

I'm making a part of my game where you must get a key to open a door. The hard part is that I would like:

When the door is locked: If you walk up to the door, nothing happens. But if you hit the action button while touching the door, it says "The door is locked." If you have the key, it will ask you if you would like to unlock it.

When the door is unlocked: You can walk straight through the door, but nothing happens if you press the action button while touching it.

This is why I used multiple event pages, to have two different triggers do different things on a single tile. The problem is that when I did this for the first time, it didn't work. I looked up the problem online and it seemed that the only way to use multiple event pages was to have the conditions for one event to be active, while the conditions for the other to be inactive.

So, I made two switches per door.

One switch gets turned on at the start of the game when the player leaves the first room. This is the "lock" switch.

The other switch is off, but gets turned on when the door is unlocked. This is the "unlock" switch.

The first event page my locked door has is only active when the door is locked, or when the "lock" switch is on. Once they have acquired the key, the "lock" switch is turned off, and the "unlock" switch is turned on. This disables the first event page, and let's the player use the action button to unlock the door. After it is unlocked, they can walk through.

This system worked for me until I realized, if the player ever returns to the first room (their bedroom) it re-locks the doors, with no way to unlock them because the keys have already been acquired.

Please help me find a better way to program these doors. I would like them to still work as I described at the beginning, but not having to enable my "lock" switches in the first room of my game.

Also, would you mind explaining how multiple event page work? I want to be able to have two different triggers do different things on a single tile. Thanks.
1) only one event page can be active at any given time, you can't have two pages active at the same time.
2) highest page number = highest priority. If several pages have their conditions fulfilled at the same time, the page with the higher page number becomes the active one.

for your solution, you don't need two different active pages however, and neither you need two switches - you simply messed up your event logic without need.

first page: no conditions, door locked, on action button use a conditional branch to check if the player has key or not. show text locked if not, control self-switch A = on with showtext "you use key to unlock" if yes.
second page condition self-switch A and open - without content so that nothing will happen on action trigger. Use either through or priority below to make the door passable, or a regular door sequence on event touch to get through

Original thread: https://forums.rpgmakerweb.com/threads/got-a-question-about-how-to-use-multiple-event-pages.117751/