How can I tell Inform 7 that a room contains a few barstools (let’s say three), so the player can examine them collectively, but when they ‘> sit on barstool’ they aren’t asked which one, they just sit on one of them (and then aren’t told they’re on all of them)? I want to avoid disambiguation issues, and I’m just wondering if someone knows a tidy way around this before I end up writing reams of junky code for something (I hope) fairly simple.
Thanks for reading.
I don’t know if this is the best way or even a good way compared to what others do, but for furniture situations like this, I usually make a ‘barstools’ scenery object in addition to the individual seat.
First, the ‘barstools’ object. Just a thing with scenery, not a supporter.
The description of this should just be the general description of the barstools. You probably also want to make some rules to catch situations where a player tries to manipulate this particular object. (For example, “sit on barstools” prints “you can’t sit on all of them.”)
Now add the real ‘barstool’ supporter. Make sure to also use “Instead of examining barstool, try examining barstools.”
I suggest only having one actual barstool unless your story has a technical need for more.
This is bad practice as it prevents the other carry out examining rules from firing. It’s much better to use the description property than an instead rule here, like so.
[code]The description of the barstool is “[the description of the barstools]”.
The description of the barstools is “This will be the description for both the barstool and the barstools”.[/code]
This will give the same thing when examining either the barstool or the barstools.
Hope this helps.
This is bad practice as it prevents the other carry out examining rules from firing. It’s much better to use the description property than an instead rule here, like so
I disagree. They both have quirks, but there’s no strong reason to prefer one over the other as long as you take account of this in the rest of your code. This is pretty much true of all I7 action conventions. You have to pick where you put your rules, but there is no perfect system for doing so – it depends on what your game needs to do.
(Potential problem with interpolating descriptions: you can’t reliably test “if we have examined the barstools”, because that flag winds up set separately for the two objects.)
In this case, I would absolutely use the “instead of examining: try examining” rule. Any barstool-specific examine rule would have to go on the barstools object, but that’s easy to remember. Any generic examine rule will still take effect, because the inner “examine” will go through the full action process and trigger it.