Modifying the description of undescribed things

I want to make the response to examining undescribed things change during a particular scene. I gather modifying/replacing the examine undescribed things rule is my best course, yeah?

The new_examine_undescribed_things rule substitutes for the examine undescribed things rule.

This is the new_examine_undescribed_things rule:
	if Scene_Dreams is not happening:
		say "You see nothing [one of]interesting[or]noteworthy[or]special[at random] about [the noun].";
	else:
		say "Details are foggy.";
	now examine text printed is true.

I added the last line because “Details are foggy” was printing even when a description was provided.

I would not have known about the last line had I not found it in one doc example and in Graham Neelson’s exhaustive “INFORM 7: The Program” document.

However, the last line throws an error that I can’t figure out.

Problem. In the sentence ‘now examine text printed is true’ [](source:/Users/wmodes/Google Drive/dev/bearcreek/Bear Creek v2/Bear Creek v2.materials/Extensions/wes modes/bearcreek.i7x#line385), I was expecting to read a condition, but instead found some text that I couldn’t understand - ‘examine text printed is true’.

I assume it is not recognizing the variable. What is the legit way of doing this?

If you open the Standard Rules (under the menu File → open Installed Extension → Graham Nelson → Standard Rules) then search for the examine undescribed things rule, you find this:

Carry out examining (this is the examine undescribed things rule):
	if examine text printed is false:
		say "[We] [see] nothing special about [the noun]." (A).

Essentially this is a default ‘fall-through’ rule that runs when all the other more specific ‘Carry out examining’ rules (of which there are a number, for example to print out descriptions when provided and to print out the contents of containers and supporters) have run their course. Each of them, if it prints text, sets the flag ‘examine text printed’ to true. So, when this last rule is finally reached, the familiar ‘You see nothing special about the thingumajig,’ will only be printed if nothing else has already been output.

To replace this rule, you need to emulate its form with your own:

The new_examine_undescribed_things rule substitutes for the examine undescribed things rule.

This is the new_examine_undescribed_things rule:
	if examine text printed is false:
		if Scene Dreams is not happening:
			say "You see nothing [one of]interesting[or]noteworthy[or]special[at random] about [the noun]." (A);
		else:
			say "Details are foggy." (B);

Unfortunately, this involves the action variable ‘examine text printed’, which is valid only within the Examine action rulebooks, and when compiling Inform has not yet placed the substitute routine in place and therefore (outside the Examine action rulebooks) can’t find a valid reference to this variable and generates the compilation error.

Getting round this by being specific about where the rule is going to go:

Carry out examining (This is the new_examine_undescribed_things rule):
	if examine text printed is false:
		if Scene Dreams is not happening:
			say "You see nothing [one of]interesting[or]noteworthy[or]special[at random] about [the noun]." (A);
		else:
			say "Details are foggy." (B);

allows this to compile, but creates a new problem because the rule now runs twice: once as a substitution for the original rule then again because the new rule itself is now also listed last in the Carry out Examining rulebook (you can verify this by typing >Rules, which will demonstrate the rule running twice, and by looking at the Examine action in the Index, which shows both the substituted original rule and the new rule itself listed in the Carry out Examining rulebook). This is why the response is printed twice.

There are a few ways of dealing with this. One is to append ‘now examine text printed is true’ to the end of the rule, so that the second time it fires nothing is printed. The neater one is to unlist the new version of the rule by writing ‘The new_examine_undescribed_things rule is not listed in any rulebook.’ This allows the compilation to take place (because Inform still recognises it as a Carry out Examining rule, even though it’s no longer listed in the Examining action’s rulebooks, and so allows it access to Examine action variables), keeps the substituted rule in place, but removes the redundant copy from the Carry out Examining Rulebook. A third option, but probably not the best, is to append ‘rule succeeds’ at the end of the rule, which forces an exit from the ‘Carry out examining’ rulebook and ensures that the rule will only fire once even if listed twice. This might cause problems if for any reason you or an extension decide to put an even later rule into the ‘Carry out examining’ rulebook, which would never then be reached.

PS the rule for examining undescribed things is the only one that doesn’t usually need to set the ‘examine text printed’ flag when it prints something because it is the last rule in the book to run, so there are no rules coming after that need to examine the flag.

1 Like

The easiest course is to use the response system.

The examine undescribed things rule response (A) is "[if Scene_Dreams is not happening][We] [see] nothing special about [the noun][else]Details are foggy[end if]."
1 Like

Neat :laughing:

Oh god, so much easier. I thought there might be a response, but when I looked at “RESPONSES 1” I didn’t see it. We don’t have a feature like SCENES and ACTIONS that tells what responses are triggered yet.

1 Like

There’s no built-in actions for that but you can add it yourself easily. From the section “Issuing the response text of something” of the “Activities” chapter of Inform’s documentation:

Before issuing the response text of a response (called R):
    say "[R]: ".

Or you can look in the index, in the “Actions” tab. On the page of a specific action, you can click on the small speech bubbles to reveal the responses of each rule.

1 Like

I do it, honestly, by keeping the Standard Rules file open in an editor. I searched through for “nothing special”. It’s a line marked (A) in the “examine undescribed things” rule, so there you are.

2 Likes

I found this informative and it helped me clear up a problem I was having in my own code, so thanks for the detailed explanation!

Just for future reference if someone is trying something more complicated than they can do with the responses system, I give you two (yes, two) more solutions for future reference:

This is the new examine undescribed things rule:
	if examine text printed is false:
		if Scene Dreams is not happening:
			say "You see nothing [one of]interesting[or]noteworthy[or]special[at random] about [the noun]." (A);
		else:
			say "Details are foggy." (B);
	now examine text printed is true;

The new examine undescribed things rule is listed before the examine undescribed things rule in the carry out examining rulebook.

or

This is the new examine undescribed things rule:
	if examine text printed is false:
		if Scene Dreams is not happening:
			say "You see nothing [one of]interesting[or]noteworthy[or]special[at random] about [the noun]." (A);
		else:
			say "Details are foggy." (B);
	now examine text printed is true;

The new examine undescribed things rule is listed instead of the examine undescribed things rule in the carry out examining rulebook.

If you use either of these forms, Inform knows what rulebook you’re putting the rule into (unlike the “substitutes for” form of rule substitution) and avoids the compilation error – at least with 6M62. “Before” ends up being “immediately before”.

1 Like

Thanks. Thought there must be a less convoluted way of achieving this.