Blocking access to rooms without locks

Hi, I’m a bit new to Inform 7, and I wanted to make sure the player reads a certain note before moving out of the initial room.

So essentialy it would go like this:

1- if the player tries to go west (out of the room)

2- say that they should search the room more closely

3- when the player reads the note, allow player to finally leave room

I’ve been trying to do it with the following:

if the note is not read: if going to the dorm hall: say "You really shouldn't just wander aimlessly."; stop action;

But obviously, it didn’t work. I also tried making a separate object to use as a boolean to use instead of “note is not read”, also did not work.

Instead of going from Dorm Room 497A when we have not examined the note:
    say "Leaving your room would take too much effort.".

that works, thanks.