Two doors leading east from one room?

Hi,

I’m trying do do something like a corridor with labeled doors. The compiler won’t even let me place two doors in the same direction from one room, but it’s relatively easy to add custom enterable things (I call them passages) that act as one-way doors, moving the player to the destination after entering.

What i’d like to do is just catching the action of going east so that the disambigualtion kicks in. For example, assuming I have two passages called door a and door b in a corridor, “enter door” works the way I want. What I want to do is, conceptually:

Instead of going east, do "enter door".

By conceptually I mean I know it doesn’t work. :slight_smile:

I could probably do this with an “after reading the player’s command”… thing, but I feel like I am complicating things a lot. Is there some simpler approach to this? Except for the obvious approach of redesigning the map, splitting the corridor into a north and a south end or just hooking up the two rooms as northeast and southeast.

Maybe using custom directions?

Instead of going east in the Q-corridor: try entering the Z-door.

This would probably be the best answer from a design point of view, and not just because it’s easier to implement.

But for the sake of argument, if you really want to have two doors to the east and make the >EAST command require disambiguation:

[code]Corridor is a room.

A passageway is a kind of thing. A passageway is always fixed in place. A passageway can be enterable. A passageway is usually enterable.

The blue door is a passageway in Corridor.
The red door is a passageway in Corridor.

After reading a command when going and Corridor is the location:
let T be indexed text;
let T be the player’s command;
replace the regular expression " e$" in T with " door";
replace the regular expression " east" in T with " door";
replace the regular expression “^e$” in T with “door”;
replace the regular expression “^east” in T with “door”;
change the text of the player’s command to T.

Understand “[a passageway]” as entering.[/code]Note the spaces, to prevent the regex from erroneously matching “go ne” or “go southeast”.

I believe that the only way to provoke a disambiguation message from within Inform is to manipulate the player’s command.

Here’s another pretty easy kind of solution that may work for you.

[code]The Pub, the Gents’, and the Ladies’ are rooms.
The door to the Gents’ is a door. It is southeast of the Pub and west of the Gent’s.
The door to the Ladies’ is a door. It is northeast of the Pub and west of the Ladies’.

Understand “east” or “e” as a mistake ( “You can choose to enter the Ladies[’] room or the Gents[’] room.”) when the location is the Pub.[/code]

Thanks guys.

ChrisC, cool, this works, and I guess it wasn’t that much easier than what I feared…

is what I hadn’t figured out.

Your code doesn’t quite work for me though, maybe you’re not “going” here? I replaced this bit:

After reading a command when Corridor is the location:
   let T be indexed text;
   let T be the player's command;
   replace the regular expression "^(go +)?(e|east)$" in T with "door";
   change the text of the player's command to T.

The fix was removing “when going”, the regexp hack was just for show. :slight_smile:

How about something like this (untested, and I may get some of the syntax wrong)?

[code]Instead of going east in the corridor: disambiguate the doors.

To disambiguate the doors:
say “Which door would you like to go through?”;
change the command prompt to "type red or blue, or another command: ".

First before: if the command prompt is "type red or blue, or another command: ", now the command prompt is “>”.

Understand “[a passageway]” as entering when the command prompt is "type red or blue, or another command: ". [/code]

Even if this does work, you’d have to be careful to make sure that the command prompt is the same in all occurrences; in fact, while typing this, I left out the punctuation a couple of times. Maybe it would work better to leave the command prompt alone and set a flag instead.

Felix: that doesn’t catch “go east,” “walk east,” etc., does it? I think the mistake mechanism is probably too unsubtle for this. (I have the same concern about ChrisC’s fix.)

The problem is that you there IS no way east from the corridor, as far as the parser understands, so “instead of going east” won’t work - unless you start messing around with other rules, or add yet another, fake, exit - or maybe make one of them a normal door and the other a “passageway”.

This feels like a hack however you do it. I’ll probably just avoid the problem.

The regexp matches “e”, “east”, “go e”, “go east” with any number of spaces in the middle. Not “walk east”, though, but that could be added of course. Who the heck types “walk east” anyway? :slight_smile:

Doesn’t “instead of going east in the corridor” work? I thought (not looking it up) that “going east in the corridor” works when there’s no east exit, but “going east from the corridor” requires an exit.

There’s probably some folks out there who type “walk east,” and there may be noobs and stuff who’ll try it. When I tried “Cold Iron” out on a noob, she got surprisingly far typing fairly natural stuff like “look at the table” – though the compass direction navigation was what gave her the most trouble. “Go through the door” would probably be what she’d try.

Avoiding the problem isn’t a bad idea, as a player, I’d probably prefer splitting up the directions to splitting up the rooms.

Yes.

Yes, you really go need to keep covering the library standards: “go east”, “walk east”, “walk through the door”, “go in door”, etc. Handling those is automatic as long as you stick to overriding actions. When you start messing around with regexps, it’s very easy to break synonyms without noticing.

(“Go through the door” does work in Cold Iron. :slight_smile:

As for the “disambiguate the doors” plan, I can only say “Please don’t do that.” If you really need to go that route, grab the Disambiguation Control extension, which does it inline with the parser.

In fact I think that is how my friend got out of the house without any help from me. It was when she was outside and started having to go southwest and the like that she needed a nudge. (I noticed this old post from you which demonstrates the need to capture “walk south.”)