Text substitution [regarding <number>] does not affect [s]?

This is easiest to demonstrate with a scenario:

Place is a room.

A box is here.

A toy is a kind of thing.

Two toys are in the box.

Instead of taking the box when something is in the box:
	say "The box is too heavy with the [regarding toys in the box]toy[s] in it."

Test me with "take box / take toy / take box / take toy / take box".

which yields:

Place
You can see a box (in which are two toys) here.

>get box
The box is too heavy with the toys in it.

>get toy
Taken.

>get box
The box is too heavy with the toys in it. [<-- ???]

>get toy
Taken.

>get box
Taken.

As you can see, the [s] substitution is not taking its cue from the [regarding...] substitution. I thought that it was just that it needed to be fed a number, but:

Instead of taking the box when something is in the box:
	say "The box is too heavy with the [regarding the number of toys in the box]toy[s] in it." [changed]

doesn’t fix the issue. The underlying routines are:

[ STextSubstitution;
	if (say__n ~= 1) print "s";
];

[ RegardingNumber n;
	prior_named_list = n;
	prior_named_list_gender = -1;
	prior_named_noun = nothing;
];

The STextSubstitution() routine is only responsive to the value of say__n, which is not updated by RegardingNumber().

For my own purposes, I’ve updated the latter to:

[ RegardingNumber n;
	prior_named_list = n;
	prior_named_list_gender = -1;
	prior_named_noun = nothing;
	say__n = n;	! ADDED
];

Does the default behavior count as a bug?

say__n is set whenever you directly print a number, or “say [N in words]”. Are there any other circumstances?

There are two separate responsive-text systems here (saying a number and saying an object/list), and I worry about lashing them together. In theory someone could write

say "You pick up [the treasure] and gain [price of treasure] point[s] from [them]."

This currently works because the [s] and [them] substitutions don’t step on each other.

(I guess your suggestion wouldn’t break this example – the dependency goes other way around. But you could contrive an example which is the converse. I don’t have the brainpower right now to do it. :)

I’m not sure how big a problem this really is.

There’s a related trap where someone is tempted to write

say "The [enemy] attack[s]."

…assuming that this will conjugate properly for singular or plural enemy. This doesn’t work. Your suggestion makes it work worse (it will always be wrong!) but this really isn’t a big problem.

I guess if you don’t want to cross the functionality, then a different text substitution can be created:

To say noting (N - number):
	(- say__n = {N}; -).

Then it’s possible to insert a substitution like [noting the number of toys in the box], which works the way that I expected [regarding...] to work in this case.

1 Like