Placing a locked door that opens with words between two rooms

Greetings! If I’m in the wrong place let me know and I’ll post elsewhere. I want to place a door that opens with a password, in between “The Cliff” and “The Cave”. I want it to open with a password “Open Up” or something like this. Here’s my code, please let me know how to place the door and make it openable with a password.

The Cliff is a room. The Cliff is east of the Beach and south of The Cave. "There is a large cliff that blocks your path, its rocks jutting into the water."

The Cave is a room. The Cave is north of The Cliff. "You enter a cave, it's dark and damp." The Cave is north of The Cliff.
1 Like

This would fit better in Authoring - Inform 6 and 7.

The Cliff is a room. "There is a large cliff that blocks your path, its rocks jutting into the water."

The Cave is a room. "You enter a cave, it's dark and damp." 

A magic door is a door. "A door glows to [if the location is Cliff]the north[otherwise]south[end if]." It is locked. It is north of The Cliff and south of The Cave.

After answering yourself that "open sesame" when magic door is touchable:
	if magic door is locked:
		now magic door is unlocked;
		now magic door is open;
		say "The door clicks and creaks open as if by magic.";
	otherwise:
		say "Nothing happens."

Cliff

There is a large cliff that blocks your path, its rocks jutting into the water.

A door glows to the north.

n

(first opening the magic door)

It seems to be locked.

open door

It seems to be locked.

say open sesame

(to yourself)

The door clicks and creaks open as if by magic.

l

Cliff

There is a large cliff that blocks your path, its rocks jutting into the water.

A door glows to the north.

n

Cave

You enter a cave, it’s dark and damp.

A door glows to south

Alternately:

Include Inanimate Listeners by Emily Short.

The iron door is an addressable door. It is north of Foo and south of Bar. It is closed, locked, openable, and not lockable.

Instead of answering the iron door that a topic:
    say "Nothing happens. The door seems unimpressed."

Instead of answering the locked iron door that "xyzzy":
    say "You hear the click of a mechanism inside the door.";
    now the iron door is unlocked.

The adjective “addressable” is the key: it makes it so that we can talk to the door.

SAY XYZZY TO DOOR
DOOR, XYZZY
SAY XYZZY

Any of these three will work when adjacent to the door.

1 Like

@Draconis’s example also helps to explain the somewhat odd-seeming phrase “answering yourself that” in mine.

I discovered it by running the game in the IDE and typing ACTIONS at the prompt, then trying what I want the player to type: SAY OPEN SESAME.

The action will fail, but ACTIONS indicates it’s trying “answering yourself that 'open sesame’”. (The parser disambiguates that the only animate thing to hear what the player says is the player - ‘yourself’.) That lets you know if there’s a built-in action available for that input, or if you need to create a new one. Similarly, when he made the door an animate listener, it takes the phrase “answering the door that ‘xyzzy’

The included extension “Inanimate Listeners” by Emily Short is what enables you to declare a door animate so it can react to commands.

But only if the player is the only animate thing in the location, surely?

Cliff
There is a large cliff that blocks your path, its rocks jutting into the water.

A door glows to the north.

You can also see Sinbad here.

>say open sesame
(to Sinbad)
There is no reply.

>

Thank you all, I was able to get the door placed and able to open with a magic password. Thank you very much! However, now the door is ‘glowing to the north’ when I am in the Cave, which is north of the Cliff, meaning when I enter the Cave the door should be ‘glowing to the south’. How do I fix this? Here is my code.

The Cliff is a room. The Cliff is east of The Beach. “There is a large cliff that blocks your path, its rocks jutting into the water.”

The Cave is a room. “You enter a cave, it’s dark and damp.”

A magic door is a door. “A door glows to the north.” It is locked. It is north of The Cliff and south of The Cave.
The description of the magic door is “there doesn’t appear to be a keyhole or handles of any sort on the sufrace of the door.”

After answering yourself that “retreat” when magic door is touchable:
if magic door is locked:
now magic door is unlocked;
now magic door is open;
say “The door clicks and creaks open as if by magic.”;
otherwise:
say “Nothing happens.”

Hanon covered this in his post, see above! :slight_smile:

You can also say:

A magic door is a door. "A door glows to [the direction of the magic door from the location]." It is locked. It is north of The Cliff and south of The Cave.
1 Like

Thank you! I could not remember that phrasing but I knew you could do it.

1 Like

Still having trouble :frowning:

Look at the string “A door glows to north.” That’s defining the literal text that will appear. If you want it to change, you’ve got to add substitutions to that text:

"A door glows to the [direction of the magic door from the location]."
2 Likes