Get object reveals names of similar hidden objects in room!

If you have two hidden objects of the same type in a room and one is revealed by examining something, when you then take the object, the parser reveals the name of the second hidden object! Consider the example in the screenshot. Two letters are hidden in the room.

The solution I used was to remove one of the objects. I’m not sure what can be done about this as the parser’s response seems entirely logical.

Just seen a related post which had “undescribed” as the solution. Might it help here?

Just thinking out loud here:

Could you rename one of the letters with a synonym (epistle, missive, note,…) and have “letter” as a secondary synonym to that? This works in Adrift to handle some (not all) disambiguation issues.

Edit: my mistake. I used this to disambiguate between two objects while programming, so I wouldn’t have to extensively check which one of the swing-objects I was dealing with each time. In actual play, this would (probably?) lead to the same disambiguation question as in your example.

ahem… as I got, the OP ask about a I6+punyinform issue (cfr. the tags…)

On the specific, either there’s a library or your code bug in the handling of the concealed attribuite. Without an example code of your issue, I can’t diagnose more.

Best regards from Italy,
dott. Piergiorgio.

I’ve now deleted my answer, which related to Inform 7 and, even then, wasn’t much good anyway :slight_smile:

It seems like the two letters are both there already, as concealed objects. Amirite?
If that’s the case (which I can’t tell from what you write) I would rather have the two letters out of game and move them one by one (move Letter1 to Location) when the discovery is made.
This will not solve the disambiguation once both letters are in scope, but I guess that’s what disambiguation is for.

1 Like

What do you do to hide the letters?

If the “crumpled letter” is inside a hat box (which I assume is a non-transparent container) and the hat box is closed, that letter will be entirely hidden anyway, until you open the hat box. But where have you placed the “old letter” and what have you done to make it non-visible?

This is exactly the kind of situation the concealed attribute was created for. If you want the old letter to be present, the player should be able to refer to it, but it should never appear in a disambiguation question, give it concealed.

Here is the code for the letter hidden in the hatbox. I moved the old letter out of the room but the code is similar for each letter I’ve hidden.

Object -> -> Hatbox "hatbox"
	with name 'hatbox',
	description "A small round hatbox covered in black velvet with a pink ribbon around it.",
    after [; Open:
       if (CrumpledLetter in self) {
          move CrumpledLetter to parent(self);
          "There's a crumpled up letter inside the hat box.";
	has container openable;

Object -> -> -> CrumpledLetter "crumpled up letter"
	with name 'crumpled' 'up' 'letter',
	description "The letter is all crumpled up and covered in scribbles made by a crayon.",
    has scored;

Why are you moving the letter outside the hatbox? (I would get it if you would also print that the letter falls out of the hat box, but you don’t) Anyway, that doesn’t really have an effect on the question at hand - why does the parser ask which letter the player means?

As far as I can see, this letter is hidden until you open the hat box and then it’s visible and accessible, as it should be. So this letter seems to work as intended?

Should the old letter be in the same location? And should it be inside a closed non-transparent container, just like this letter is when the game starts?

I am still learning PunyInform and often copy bits of code from the manuals which I then change to fit my game, which is why I often get it wrong.

I looked at a saved file for when I had two letters in the same room and here’s the code for the old letter. (I later moved the old letter to another room so there is only one letter hidden in any of the rooms.)

Object -> TableRed "square table"
	with name 'square' 'table' 'wooden',
	description "A square wooden table that fits nicely in the corner.",
    after [;
       if (BlackKettle in self)
          move BlackKettle to RedBedroom;
          "There's a black kettle on the table.";
	has scenery supporter;

Object -> -> BlackKettle "black kettle"
	with name 'cheap' 'black' 'plastic' 'kettle',
	description "A cheap black plastic kettle.",
    after [; Examine:
       if (OldLetter in self)
          move OldLetter to parent(self);
          "Inside the kettle there's an old letter.";
	has container openable open;

Object -> -> -> OldLetter "old letter"
	with name 'old' 'letter',
	description "The letter is written with a fountain pen, with long sloping letters that you can't easily decipher.",
    has scored;

The letter isn’t really hidden in this code. It’s just that the letter is on a scenery supporter, and PunyInform doesn’t print the contents of scenery supporters, at least not by default (If you add Constant OPTIONAL_PRINT_SCENERY_CONTENTS; to your code, PunyInform will print the contents).

To make the object hidden, you should give it the concealed attribute. This is what makes the parser try its best not to tell the player about the object, so it won’t say stuff like “Which do you mean, the old letter or the crumpled letter?”. You can add or remove the attribute at any time during play as well.

[quote=“fredrik, post:10, topic:52370, full:true”]
Why are you moving the letter outside the hatbox?[/quote]

This is my first game so the code is most likely not the best way of doing it.


It was in the same location but I moved it to avoid the parser revealing it.

Thank you. Oddly some of my code does use the concealed attribute.

Object -> Pot "flower pot"
	with name 'flower' 'pot' 'dusty',
	description "The dusty flower pot hasn't been used to hold any flowers in a while.",
    after [; Examine:
    if (LetterPot in self)
          move LetterPot to Landing;
       "There's a curious letter inside the pot.";
    has concealed container open;

1 Like