[i7] Hi and quick question

Hi all, newcomer to i7 - (good to get back into IF programming), and have a really quick question if I may. I’ve looked through the posts and manuals but can’t find anything specific on this.

How do I disambiguate between two objects that are the same without it being clunky? Have looked at the disambiguation thread below, but it seems to answer a different question.

So if, for example, the player has a watch, and meets an NPC with a watch. How do I not have to have a ‘Shiny watch’ and an ‘Old watch’.

So for example :

x watch
Your watch or NPC’s watch?
NPC
It’s a watch. It tells the time. According to NPC’s watch, the time is 10:14 AM.
x watch
Your watch or NPC’s watch?
my watch
It’s a watch. It tells the time. According to your watch, the time is 10:13 AM.

If a second NPC wanders by and has a watch. then a third…etc… So I may have many watches.

Thanks if anyone can help with this. Apologise if it’s been discussed before, or if it’s a numbskull problem!

McT.

You haven’t defined what you would consider “not clunky”. If the player just types >X WATCH, do you want Inform to automatically assume it’s his own watch? This is pretty straightforward with a Does the player mean rule.

Does the player mean examining something worn by the player: it is likely.

Of course you could use “it is unlikely” if you want Inform to default to examining other people’s watches rather than your own. See Writing with Inform 16.19.

If you mean something else you’ll have to specify your problem more precisely. (What I’m trying to say here is that I don’t have any “does the questioner mean” rules applying to your question.)

Basically, I can’t work out how to implement two objects with the same name that can be referred to with the same noun, but are still two different objects. :slight_smile:

Well, you’d change the printed name.

The printed name of player's watch is "watch".
The printed name of alternative watch is "watch".

But that puts you in a shitty place vis-a-vis disambiguation. You may want an extension like Numbered Disambiguation Choices.

But even in that situation, disambiguation will still be:
[quotation]Which do you mean?
(1) the watch
(2) the watch[/quotation]
because your printed names are identical.

I haven’t tested the following, but I think it’s what you need:

[code]A thing has some text called clarifier.
The clarifier of your watch is “your”.
The clarifier of Bob’s watch is “Bob’s”.

Before printing the name of something (called foo) while asking which do you mean: say "[the clarifier of foo] ".[/code]

(You’d either need to give everything a clarifier, or only make that fire when a clarifier exists. But that’s the basic idea.)

You could solve the disambiguation problem by making the clarifier an indexed text property of watches and including this:

Understand the clarifier property as describing a watch.

(It has to be indexed text because text properties can’t be understood.)

Here’s an implementation I typed up before seeing maga’s post (which also automatically assigns the clarifiers, or owner’s possessives as I call them, based on who has the watch):

[code]A watch is a kind of thing. A watch has some indexed text called owner’s possessive. A watch is proper-named. Every person carries a watch.
When play begins:
repeat with timepiece running through watches:
if the timepiece is enclosed by the player:
now the owner’s possessive of the timepiece is “your”;
otherwise if the timepiece is enclosed by a person (called carrier):
now the owner’s possessive of the timepiece is “[carrier]'s”;
otherwise:
now the owner’s possessive of the timepiece is “loose”.

The printed name of a watch is usually “[owner’s possessive of the item described] watch”.
Understand the owner’s possessive property as describing a watch.[/code]

Note that if you don’t understand the additional text property as describing a watch, then even if it asks “which do you mean, Alice’s watch or Bob’s watch?” it won’t understand the answer. That’s bad!

If you have few enough watches you could always just name them “your watch,” “Alice’s watch,” “Bob’s watch” etc. in the source code and save yourself some headache.

Thanks all for the responses. It’s all working as it should now. Much appreciated.