Seeing adaptive text responses for different tenses and points of view

This request falls squarely into the “I’m sure I saw it somewhere and now I can’t find it” category.

I thought I saw an Inform 7 document section, or an example, or extension, that will print out responses to a given action in all the different tense and point of view permutations. A nice little testing tool for testing adaptive text in responses.

Does this sound familiar to anyone?

Sounds like maybe you want this from Eleas (Björn Paulsen):

To say (x - a text) in all forms:
	say "For the phrase '[x]', the tenses are:[line break]";
	repeat with tense running through grammatical tenses:
		now the story tense is the tense;
		repeat with viewpoint running through narrative viewpoints:
			now the story viewpoint is the viewpoint;
			say "[viewpoint], [tense]  ------  '[x]'."


There is a room. When play begins, say "[We] [are] here." in all forms.
4 Likes

Thanks, this code does the trick.

I did a slight tweak to restore the current tense and viewpoint afterwards, and added bold formatting to the current tense and viewpoint:

To say (x - a text) in all forms:
	let current tense be story tense;
	let current viewpoint be story viewpoint;
	repeat with tense running through grammatical tenses:
		now the story tense is the tense;
		repeat with viewpoint running through narrative viewpoints:
			now the story viewpoint is the viewpoint;
			if story tense is current tense and story viewpoint is current viewpoint:
				say "[bold type]";
			say "[viewpoint], [tense]  ------  '[x]'[roman type][line break]";
	now story tense is current tense;
	now story viewpoint is current viewpoint.

Follow up question on this. Trying to turn this “To say” phrase into a testing command. Here’s my code:

To say (x - a text) in all forms:
	let current tense be story tense;
	let current viewpoint be story viewpoint;
	repeat with tense running through grammatical tenses:
		now the story tense is the tense;
		say "[line break]";
		repeat with viewpoint running through narrative viewpoints:
			now the story viewpoint is the viewpoint;
			if story tense is current tense and story viewpoint is current viewpoint:
				say "[bold type]";
			say "[viewpoint], [tense]: '[x]'[roman type][line break]";
	now story tense is current tense;
	now story viewpoint is current viewpoint.

Expanding adaptive is an action out of world applying to one topic.

Report expanding adaptive:
	say "[the topic understood]" in all forms.

Understand "expand [text]" as expanding adaptive.

When I type in:

expand [We] [are] happy.

Expected result:

first person singular, present tense: "I am happy."
second person singular, present tense: "You are happy."
third person singular, present tense: "He is happy."
first person plural, present tense: "We are happy.
(...)

Observed results:

first person singular, present tense: "[We] [are] happy."
second person singular, present tense: "[We] [are] happy."
third person singular, present tense: "[We] [are] happy."
first person plural, present tense: "[We] [are] happy."
(...)

Any help is greatly appreciated.

So, when you use something like “[We] [are] happy”, that doesn’t actually compile down to a literal string. It compiles down to a routine that calls [We], prints a space, calls [are], then prints " happy".

In other words, the substitutions happen at runtime, but the brackets-within-quoted-text construction is processed at compile-time (unlike in, say, Python).

1 Like

So the short version (I think) is that when you type “[We] [are] happy” at the command prompt, that just can’t be understood the way it’s understood when you’ve written say "[We] [are] happy." in your source code. The bit of the command will only be understood as the literal string “[We] [are] happy.”

I’m not sure if this circle is squarable. The “response” kind isn’t something that can be understood as part of a typed command, alas. You could repeat through responses and expand them all that way if you want a truly massive text dump.