Synonyms for objects

Can someone please explain to me, in full, how to write out synonyms for objects??

I have written several released games, but apparently I don’t fully understand 'Understand…(synonym part)/(synonym part)/-- (synonym part)/-- (synonym part)/(synonym part)" as (object). Let me give you an example of how I have been doing it (thinking it is working).

An iron handle is here.  It is scenery.  The description is "The handle was hanging down from the manhole cover that I moved; [if the iron cover is open]the cover was lying partially over the manhole[otherwise]the cover was now covering the hole[end if]."  Understand "manhole/iron/-- cover/lid/-- cover/lid/handle" as the iron handle.

I was thinking that if the player typed only ‘cover’ or ‘lid’, that would work. I was thinking that the parser would take any one of the first two groups of words as ‘optional’ while one of the last group of words would be required, and any one of those words would be adequate. But I get only ‘I couldn’t see any such thing.’ when I test it. Which leads me to think that many of the 500-odd other objects that I have implemented also have wrong ‘Understand’ clauses.

Now, when I type ‘manhole lid lid’, it works. Or ‘iron cover cover’. Weird. (by the way, the iron cover is a scenery item on the floor of one room, and the iron handle is another scenery item in a room directly under it, and I am making the handle synonymous with the cover that it is ‘under’)

So can someone please spell it out for me (to coin a phrase)?

Thanks.

I wrestle with this myself, but my understanding from the documentation is that you can only have one “–” per Understand statement:

 If "--" is an option, it can only be given once and at the end of the list of possibilities.

The documentation is a bit ambiguous, but obeying that rule has generally worked for me, so maybe having two "–"s is what’s driving your problems? I tend to use multiple Understand statements in situations where the different potential phrases have major variations in the number of words, which has been successful so far though makes the code a bit longer.

2 Likes

Understand “manhole/iron/-- cover/lid/-- cover/lid/handle” as the iron handle.

The problem here is that the parser is greedy about accepting words. When it sees GET COVER, the word COVER fails to match the first group (“manhole/iron/–”). Then it does matches the second group (“cover/lid/–”). Now COVER is consumed. Then the parser looks at the third group (“cover/lid/handle”), which has no “–” option. But no more words are available, so it fails the match.

GET COVER COVER will succeed; you can follow the logic through and see why.

The lesson is to not use a single word in multiple places in a phrase like that. What should you do instead? That depends on what kinds of inputs you want to recognize for this object. I’m not sure what you’re aiming at when you want the handle to be synonymous with the cover. If they’re in different rooms, you should be able to get away with

Understand "manhole","cover", "lid" as the iron handle.

Then any combination of those words (including “iron” and “handle”) will work. There won’t be a collision with the manhole cover because that’s in a different room.

4 Likes

Thanks guys.

Actually, in the inner world, the handle is on the underside of the cover–the player doesn’t see it, and cannot refer to it, when the player is in the room above it, where the cover actually is. But the player will be able to refer to both the handle and the cover when the player is in the room below, because there, both can be seen. But perhaps I can make the handle referrable from above once the player has seen it from below, in which case I can use ‘Understand…as the iron cover when the iron handle is seen’ (using Epistemology).

Thank you for explaining that in full Andrew! And thank you, Mike for your effort!

So I can just say ‘Understand “manhole”, “cover”, “handle”, “iron” or “lid” as the iron handle’ and the player can type ‘iron cover handle’ to refer to it? I tend to want to allow the player to type the longest possible name for an object. That seems to simplify my task greatly. Does it make a difference if I use ‘and’ instead of ‘or’ (will the ‘or’ make the parser allow only one of those words, rather than all of them?)

Thanks!

1 Like

Yes. In fact you don’t have to specify “handle”, “iron” in that list. The compiler throws those words into the list automatically because things are publicly-named by default.

Right, that’s the default behavior. X IRON MANHOLE LID COVER HANDLE will work.

No. Try it.

2 Likes

This sounds like a case where it might be best to keep the handle out of play until the player sees it. If you want the player not to be able to refer to something, the best way to do that is to leave it off-stage until the critical moment. So you would do something like:

Carry out going to the sewer: now the handle is part of the manhole cover.

And then you don’t necessarily have to worry about conditional Understand statements.
(I haven’t tested to see whether that particular code works, e.g., whether it produces the messages in the order you want. And if you had another way of getting to the Sewer besides going, you’d need a check for that too.)

2 Likes

Wow. Thank you all!

Now I am actually eager to edit the Understand statements for all 500+ objects in my game. And the 4 other games I’ve released (plus those that I have not)! Not really a bad thing, I think they are due for edits, as much as I have learned about Inform since I made them, over the past 4 years. I am actually looking forward to this.

Thanks again!