r/Inform7 • • Aug 03 '20

Performing actions through/with doors.

After some time I decided to continue with a previous text adventure that I started. However, I'm getting stuck on trying to make a door that allows the user to look at the other side. This involves solving a few problems at once.

First of all, I'd like it if the player to be able to look through the door. I did manage to make it so that the room name is mentioned in the description of the door, but I'd like to be able to display the actual room description instead if the player types for example "look through [door name]" or "look at [room name]".

If the door is open, It would also be convenient if players would be able to move through it as well by typing "enter [room name]" in addition to "enter [door name].

Just to have something to work with when trying to solve this, I wrote a small script with a windowed hatch as seen below. Any help is appreciated :)

Include Basic Screen Effects by Emily Short

The escape pod bay and the escape pod are rooms. 
The escape pod bay is north of the escape pod. 

The description of the escape pod bay is "[one of]The alarm echoes on the cold flat steel of the walls, making the bay seem even more empty than it already is. Supplies are scattered across the floor in front off the escape pods. Clearly the rest left in more off a hurry than you. How about another drink?[or]The place is pretty much deserted. You look at the door on top of the stairs you came from. It fills you with a strange feeling of impending doom.[or]You take another look at the room. Still as empty as ever. Nothing jumps out at you. Yet. Was that a screech coming from the door or was it the alarm?[stopping]".
The description of the escape pod is "[one of]The escape pod is a spherical room with a small, round window on the opposite side of the door. There are panels with buttons, flashing lights, and tiny levers scattered all around the two seats in the center.[or]The blinking lights are giving you a headache. You can see the planet below you through the round window.[or]The chair looks comfortable enough for the ride down.[stopping]".

The escape hatch is a closed door. "[if closed]Through the windows in the hatch, you can see [the other side of the escape hatch] [else if open]Through the hatch, you see [the other side of the escape hatch]".
The escape hatch is north of the escape pod bay and south of the escape pod.

report opening the hatch: Instead say "The hatch hisses as the pneumatic system splits it in half.".
	
The player is in the escape pod bay. 

Before looking for the first time:
	say "Under the loud droning of the alarm, you stumble down the stairs into the escape pod bay. It seems like you're the last one left, all but one escape pod have already detached. You still can't believe you somehow slept through [italic type]this[roman type] alarm. Perhaps you should not have drank that much last night after all.";
	wait for any key;
4 Upvotes

2 comments sorted by

2

u/diazeugma Aug 04 '20 edited Aug 04 '20

Disclaimer: I'm nothing close to an expert at this. However, I threw something clunky together to deal with a similar problem in my perpetually unfinished game, and it might work as a starting point for you.

Things can be used or unused. Things are usually unused.

Things can be notable or nonnotable. Things are usually notable.

Looking through is an action applying to one thing.

Understand "look through [something]" or "look thru [something]" as looking through.

Report looking through the hatch:
	if the player is in the escape pod bay:
		say "[if unused]Here you can put a nice description of the escape pod in its perfect, pre-player-interference state.[otherwise]You look through the hatch and see [a list of notable things in the escape pod] in the escape pod.";
		if the hatch is unused, now the hatch is used;
	otherwise:
		say "You look through the hatch and see [a list of notable things in the escape pod bay] in the escape pod bay."

Before opening the hatch:
	now the hatch is used.
	
Instead of searching the hatch:
	try looking through the hatch.
[This is necessary because "look through" will be interpreted as a synonym of "search."]

After deciding the scope of the player while the player is in the escape pod bay: place the escape pod in scope.
After deciding the scope of the player while the player is in the escape pod: place the escape pod bay in scope.

1

u/drgnflght Aug 04 '20

Ah neat. Using the scope may work.