Assemblies of kinds, the person asked, and disambiguation

I’m defining objects by kind (well, really I’m not, I’m defining them by category, but for this example I simplified it to be just by kind). So, I’m never defining a specific thing unless it is a person, and instead defining all other things as an instance of a kind of thing.

This makes for situations where there are multiple things that seem equal to the parser. However, I have other reasons why in the full application that it is not acceptable for the parser to ever choose one automatically.

I didn’t include those reasons here, as that would again lead to me pasting a huge chunk of code no one will read. The reasons are that sometimes it LOOKS like the items are the same to the player, but there are actually differences under the hood, and I need the player to have the freedom to choose, even when they don’t know which choice is right…

To handle this, I created a new property called “force_id”, which is a text with a number that is assigned to everything and understood. Because it is understood, it then forces disambiguation.

It all works fine, unless the person asked is not the player. Note that you will also need Numbered Disambiguation Choices by Aaron Reed set up, or it won’t work out too well even for the player :wink:, but with it, it does just fine.

If the person asked is not the player, the parser can’t decide which to select though, ending in failure.

A thing has a text called force_id.

Understand the force_id property as describing a thing.

When play begins:
	Let N be 1;
	repeat with x running through things:
		now the force_id of x is "force_id_[N]";
		increment N;

First after reading a command (this is the after manage possessives in the players command rule):
	if the player's command includes "your":
		replace the matched text with "theirs";
	if the player's command includes "my":
		replace the matched text with "your";
	let N be text;
	let N be the player's command;
	replace the regular expression "(\w)[']s" in N with "\1 [']s";
	replace the regular expression "s['](\W)" in N with "s [']s\1";
	change the text of the player's command to N;

Understand "your" as a thing when the player is the holder of the item described. Understand "theirs" as a thing when the person asked is the holder of the item described.

Understand "[something related by reversed possession] 's" as a thing.

The kitchen is a room.

The player is in the kitchen.

An apple is a kind of thing.

The player carries 2 apples.

Bob is a man in the kitchen.

Persuasion: persuasion succeeds.

Output:

kitchen
You can see Bob here.

>look my apple
Which do you mean, the 1) apple or the 2) apple?

>1
You see nothing special about the apple.

>bob, look my apple
Which do you mean, the 1) apple or the 2) apple?

>1
There is no reply.

>

I tried trace 6, but I didn’t understand what was going on. It goes pretty much bananas on this one though before failing.