My locked door is not stopping me from going north. Help!

The code is legal, but when I say “go north,” it takes me to the hallway. I’ve tried everything I can think of. Please help!

Heres my code:

The dungeon is a room. “It’s very cramped. Light shines in through the bars from outside. A skull sits in a corner. It’s smiling at you. To the north is the cell door.”

the hallway is north of the cell door. “A torch shines on the wall. To the East lies a staircase going up. To the West is a dead end.”

The cell door is north of the dungeon. The cell door is a door. The cell door is lockable. The cell door is closed and locked. The rusty key unlocks the cell door.

before going through the cell door:
if the cell door is closed and the cell door is locked:
if the player carries the rusty key:
say “You unlock the cell door with the key, and open the door. That was easy. [paragraph break]”;
now the cell door is unlocked;
now the cell door is open.

Indentation is crucial here. Would you mind putting code tags around your code?

Not sure what code tags are, but everything is indented correctly, it just didn’t carry over in copy/paste. Here’s it with indention:

The dungeon is a room. “It’s very cramped. Light shines in through the bars from outside. A skull sits in a corner. It’s smiling at you. To the north is the cell door.”

the hallway is north of the cell door. “A torch shines on the wall. To the East lies a staircase going up. To the West is a dead end.”

The cell door is north of the dungeon. The cell door is a door. The cell door is lockable. The cell door is closed and locked. The rusty key unlocks the cell door.

before going through the cell door:
(Indention times 1) if the cell door is closed and the cell door is locked:
(indention times 2 )if the player carries the rusty key:
(indention times 3 )say “You unlock the cell door with the key, and open the door. That was easy. [paragraph break]”;
(Indention times 2)now the cell door is unlocked;
(indention times 2)now the cell door is open.

Like this:

[code]

Your Inform code here [/code]

And that is indeed your problem. The last two lines are at indentation level 2, so they happen even if the player doesn’t carry the rusty key.

See here.

Now that you’ve edited in the indentation, it looks like what I said there is correct; your last two lines aren’t indented far enough, so they aren’t part of the code block beginning “if the player carries the rusty key,” and they’re running whether the player has the rusty key or not. Indent them in one more tab each and it should work.

(Also, please don’t delete or edit away questions when you don’t need them anymore. For one thing, you might be mistaken about whether you still need them, as you were that time. But more importantly, when you disappear your original question it prevents other people who might read it from getting help from it, and it makes the conversation more confusing to follow.)