Trying to get object names to work

So I’m writing a story with a bunch of street intersections. When the player is on a corner, there will be a traffic light and two crosswalk lights, one for crossing north/south, and one for crossing east/west. It seems to me that there should be three objects in the world: the traffic light, and two crosswalk lights. However, the name of the crosswalk lights would be referred to differently depending on which intersection the player is in, for example “crosswalk light across Main” or “crosswalk light across First”.

Here’s how I’ve defined this:

"I like traffic lights" by "Robert Baruch"

Section "Traffic Lights"

The traffic light is an object. The traffic light can be green for north/south. The traffic light can be green for east/west. The traffic light is green for north/south.

The description of the traffic light is "The traffic light is green to [if green for north/south]north/south[else]east/west[end if] traffic."

A street corner is a kind of room.
A street corner can be a SE street corner.
A street corner can be a NE street corner.
A street corner can be a SW street corner.
A street corner can be a NW street corner.

A crosswalk light is a kind of thing. A crosswalk light can be ok to cross. A crosswalk light is usually not ok to cross. The description of the crosswalk light is "The crosswalk light indicates ['][if ok to cross]walk[else]don't walk[end if][']."

A crosswalk light can be for north/south crossing.
A crosswalk light can be for east/west crossing.
A crosswalk light has a text called cross street. Understand the cross street property as describing a crosswalk light. The printed name of a crosswalk light is usually "crosswalk light across [cross street]".

Section "Main"

SE corner of Main & First is a street corner. It is a SE street corner. The description is "This is the southeast corner of Main and First. Main runs north/south and First runs east/west."

The traffic light is in the SE corner of Main & First.

There is a crosswalk light with cross street "Main". It is in the SE corner of Main & First.  It is for north/south crossing.
There is a crosswalk light with cross street "First". It is in the SE corner of Main & First.  It is for east/west crossing.

Well, the problem is that I can’t seem to get the names working right:

I like traffic lights
An Interactive Fiction by Robert Baruch
Release 1 / Serial number 180225 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) SD

SE corner of Main & First
This is the southeast corner of Main and First. Main runs north/south and First runs east/west.

You can see a traffic light and two crosswalk lights here.

>look crosswalk
The crosswalk light indicates 'don't walk'.

>look crosswalk lights
You can't use multiple objects with that verb.

>look Main
You can't see any such thing.

The other thing I tried is, instead of assigning a text property to a crosswalk, I just defined two crosswalks (crosswalk north/south and crosswalk east/west), and set their printed name. While this got the story to ask which crosswalk I meant, it also wouldn’t accept “Main” or “First” as options:

A crosswalk light can be for north/south crossing.
A crosswalk light can be for east/west crossing.

Section "Main"

SE corner of Main & First is a street corner. It is a SE street corner. The description is "This is the southeast corner of Main and First. Main runs north/south and First runs east/west."

The traffic light is in the SE corner of Main & First.

There is a crosswalk light north/south. It is a crosswalk light. It is in the SE corner of Main & First.  It is for north/south crossing. The printed name is "crosswalk light across Main".
There is a crosswalk light east/west. It is a crosswalk light. It is in the SE corner of Main & First.  It is for east/west crossing. The printed name is "crosswalk light across First".
SE corner of Main & First
This is the southeast corner of Main and First. Main runs north/south and First runs east/west.

You can see a traffic light, a crosswalk light across Main and a crosswalk light across First here.

>look crosswalk
Which do you mean, the crosswalk light across Main or the crosswalk light across First?

>Main
You can't see any such thing.

I feel I’m close, but I just can’t see what I need to do. Any help is appreciated!

Thanks,

–Rob

I’m not sure why, but in your first code the cross street properties aren’t getting set. Apparently Inform isn’t quite getting the “with cross street ‘Main’” part. One way to solve this is by explicitly naming the lights:

A crosswalk Light Main is a crosswalk light. It is in the SE corner of Main & First. It is for north/south crossing. The cross street of Crosswalk Light Main is "Main". A crosswalk Light First is a crosswalk light. It is in the SE corner of Main & First. It is for east/west crossing. The cross street of Crosswalk Light First is "First".

The ugly object names don’t print, because you have a printed name routine for them. (You also need to allow “across” as a way of referring to the light.)

In your second example the issue is you haven’t given an understand rule that would let “main” be understood as the light.

It might actually be simpler just to give the lights the name you want to print:

There is a crosswalk light called a crosswalk light across Main.

Then I don’t think you’d need the cross street property, or the special printed name rule, or any special understand statements.

It’s strange that the property isn’t being set. Here’s a small example for contrast.

A book is a kind of thing. A book has a text called the title. Understand the title property as describing a book.
Understand the title property as describing a book. After printing the name of a book: say " ([Title])"

The Library is a room.
There is a book with title "Bleak House" in the library.
There is a book with title "David Copperfield". It is in the library.

I’m reporting a bug.