Putting objects in rooms that share names.

Hello! I’m new here. This is a problem that has been frustrating me for a while. It’s probably explained in the documentation and I’m making a fool of myself here, but here it is anyway.

Here is an example of my problem. I have a room called “The Bermuda Dessert” (yes, dessert, not desert). I also want a thing in the room (scenery, to be precise) called “dessert”. However, inform7 gets all up in my grill telling me I can’t put an object inside itself even though they are clearly different things.

So far I’ve been getting around it by calling the thing something else, and making Inform7 understand it as the name I actually want it to be known as but surely there is a more elegant solution? Plus my little trick is easily revealed.

Here is the basic code, not that it’s of much interest:

The description of the Bermuda Dessert is “You’ve landed in the middle of the Bermuda Dessert. It extends in every direction.”

treats is scenery in the Bermuda Dessert. Understand “dessert” as treats.

You’re right about the problem, and your solution is what I do as well.

I think the only thing you need to do is to close out the use of ‘treat’ to refer to the dessert object (unless you want ‘treat’ to work). Is that what you meant about your trick being easily revealed?

To detach an obect’s internal Inform name from the words players can type to refer to it, you describe it as ‘privately-named’.

So in your case, change your second line to this:

treats is privately-named scenery in the Bermuda Dessert. Understand "dessert" as treats.

Now you refer to it as ‘treats’ in the code, but if a player types ‘(anything) treats’, Inform won’t recognise ‘treats’ as the dessert object.

One thing that’s useful here is the “printed name” property, which governs the name that Inform prints. So if you do what severedhand suggested then “x dessert” yields “You see nothing special about treats,” which is undesirable (of course that default message is undesirable in the first place). If you add:

The printed name of treats is "dessert".

then that will behave more as you wish.

Another possibility is to change the name of the room, instead of the name of the scenery object. So if you have:

The Bermuda D is a room. The printed name of the Bermuda D is "Bermuda Dessert".

then that will get the name to display as you wish. Since the player doesn’t usually refer to rooms by name, this also means you won’t need to worry as much about adding understand lines to get references to the room right.

Oh yeah, I forgot to say it, but I do that too - the printed name stuff!

Also (to repeat a hobbyhorse) there’s no reason to use “privately named” in this case. Unless the thought of usable synonyms strikes fear in your heart.

In situations like this where one object’s name is a substring of another’s, you can just declare the object with the shorter name first:The dessert is scenery. The Bermuda Dessert is a room. The description of the Bermuda Dessert is "You've landed in the middle of the Bermuda Dessert. It extends in every direction." The dessert is in the Bermuda Dessert.
At the time when Inform creates source text synonyms for the room, it will already know about the scenery dessert and throw out ``dessert’’ as a possible shortening of the room’s name.

If you want to declare them in the other order, can’t you just use “A thing called…”

The Bermuda Dessert is a room. The description of the Bermuda Dessert is "You've landed in the middle of the Bermuda Dessert. It extends in every direction." A thing called the dessert is in the Bermuda Dessert. It is scenery.

Wow, so many solutions! I’m sure one will fit my needs perfectly. Thanks to everyone for helping!