Looking at a room

I’m new to interactive fiction and to Inform. Loving it so far! But I have this simple thing I’m trying to do and I just can’t figure out how.

In a nutshell, I have a street, and a driveway. You’re standing on the street, and you can see the driveway to the North. The user wants to look at or examine the driveway.

How do I let them do that?

The street is a room.  "You are standing on the street.  There's a driveway to the North."  

The driveway is a room.  The driveway is north of the street.

When standing on the street, I want to say “look at the driveway” or “examine driveway”, but I get “You can’t see any such thing”.

I tried creating it as scenery but then there’s a naming conflict.

Thanks
– Steve

The easiest way to do it is to name the scenery object something else.

The driveway-scenery is scenery in the street. The description is "The driveway is to the north." The printed name is "driveway". Understand "driveway" as the driveway-scenery.

Another method is to allow looking at adjacent rooms, which is described in example 78 in chapter 6.14 of the manual.

That works, thanks - but there’s a complication. I’m using this:

Understand "go [any room]" as going by name. Understand "go to [any room]" as going by name.

Going by name is an action applying to one thing.

To let me say “go laneway”. With the laneway-scenery there, “go laneway” doesn’t work.

I tried the example in section 6.14 but I get this error when I attempt to use it:

Problem. You wrote ‘try looking toward the viewed item’ : but this is not an action I recognise, or else is malformed in a way I can’t see how to sort out.

GO [something] is a synonym for entering things, so you have to disable that functionality first.

Understand the command "go" as something new. Understand "go [direction]" as going. [this restores GO NORTH etc.]
Note that this has to be placed in the code before you define the going by name action, otherwise it too will be disabled.

Looks like you copy-pasted only the first half of the example. The looking toward action is defined in the latter half. (You can click the blue square in the example code to move the entire example to your source.)

Not clear on whether your “go” code is failing or whether you’re just trying to differentiate two things that now answer to the same name.

If “go [room]” is working the way you want it to, and the driveway-scenery is working, then it seems you could just use an “instead”:

Instead of examining the driveway: try examining the driveway-scenery.

Actually that would not work because the driveway is not in scope, which was the problem in the first place. As far as I understood it the problem with GO was that the game was choosing the wrong action, not the wrong thing.

Actually that would not work because the driveway is not in scope...

I guess I’m not clear on why the driveway-scenery in and of itself would interfere with the “go driveway” code then (as opposed to the “go driveway” code not working for other reasons). But perhaps I’m missing something. Hopefully the original poster will let us know if the problem got worked out.

I haven’t found a solution yet that works perfectly.

"test" by Steve Tibbett

Understand the command "go" as something new.
Understand "go [direction]" as going.  [this restores GO NORTH etc.]
Understand "go [any room]" as going by name. Understand "go to [any room]" as going by name.

Going by name is an action applying to one thing.

The street is a room.  "You're standing in the street.  You see  a driveway to the North."

The driveway-scenery is scenery in the street. The description is "It's not very long.  Maybe long enough for two normal length cars, three Smart Cars, or one of those wood-paneled station wagons." The printed name is "driveway". Understand "driveway" as the driveway-scenery.

The driveway is a room.  "You're standing on the driveway."  The driveway is north of the street.

This is the entire test project. When I run it, if I type “go driveway”, nothing happens - I just get a prompt back with no output.

I’d like to be on the street and able to say “examine driveway” or “go driveway”.

You haven’t defined what the action should do, so it does nothing. If you look at example 291 or 292 in the manual you’ll see a full implementation of the action. (Specifically, you need the carry out and check rules.)

As I explained earlier, it’s because in the standard rules GO DRIVEWAY is a synonym for ENTER DRIVEWAY. That’s why this synonym must be disabled so that the parser will not try entering the scenery object but triggers the going by name action instead. If you try stevex’s example code above you’ll see this is not an issue anymore.

Ah that worked, thank you!

Carry out going by name: 
    let aim be the best route from the location to the noun, using doors; 
    if aim is not a direction, say "You can't think how to get there from here." instead; 
    say "(heading [aim])[command clarification break]"; 
    try going aim; 
    if the location is not the noun, say "You'll have to stop here."

Thanks Nitku and Stevex. That seems like a good little snippet that might be useful in all games. I remember the old Scott Adams games used that construction (“go driveway”).

I’m trying to collect some snippets that I’ll always add to all games. For example, I like “talk to [person]” which isn’t built in and can easily be mapped to one of the other conversation verbs. And there are others.