Disable or customize a report rule for a built-in action

I notice that when I create a custom report rule for the built-in “touching” action, it works well but the default report rule fires anyway, displaying the famous “You feel nothing unexpected.” after the custom report.

Check touching something (this is the F030 - Check touching something rule):
	if (the noun is the imperial sword):
		say "When you touch your imperial sword, the blade feels strangely warm, offering a reassuring yet stern sensation under your fingers." instead;
	otherwise if (the noun is a lit firebased-lighting-tool):
		say "You wouldn't want to get burned..." instead;
	otherwise:
		continue the action;

Carry out touching something (this is the F030 - Carry out touching something rule):
	if (the noun is made of iron) or (the noun is made of steel):
		say "When you touch [the noun], it feels cold, hard, and unyielding under your fingers. [run paragraph on]";
	otherwise if (the noun is made of wood):
		say "When you touch [the noun], it feels warm, smooth, and slightly textured under your fingers. [run paragraph on]";
	otherwise:
		say "[touch of the noun] [run paragraph on]";
		
Report touching something:
	say "report test";

9:03 am - Your turn : touch short sword
When you touch the short sword, it feels cold, hard, and unyielding under your fingers. report test
You feel nothing unexpected.


I guess that I have to disable the default report rule for the “touching” action ; the unlist option provided by the index seems propose an alternative:

The report touching things rule response (report touching rulebook) is "New text.".

which does not compile:

 The sentence 'The report touching things rule response (report touching rulebook) is "New text."'   seems to give something the name 'report touching things rule response (report touching rulebook)', but that name contains brackets '(' or ')', which is not allowed since the potential for confusion with other uses for brackets in Inform source text is too high. (If you need, say, a room which the player sees as 'Fillmore (West)', you can get this effect with: 'Fillmore West is a room with printed name "Fillmore (West)".')

I suppose I’m missing a fundamental concept, but which one?

If you type RESPONSES in the IDE, you can see all built-in responses. What I’ve done before is to copy and paste those responses into a document so I can search it, and then find the exact response I want to change, and its name, which (unless it’s done differently in version 10 of Inform–I’m not using that version) usually includes a letter in parentheses.

So, for example, here are some of the default responses:

    report touching things rule response (A): "[We] [feel] nothing unexpected."
    report touching things rule response (B): "[The actor] [touch] [the noun]."

I believe you’d say something like

The report touching things rule response (A) is "New Text."

to change that first response.

1 Like

:slight_smile: Thank you very much for the explanation ; it works perfectly. (Inform 10.1.2 used here).

I always looking in the Standard Rules. The rule you want is the report touching things rule:

the report touching things rule does nothing.

should do what you want.

1 Like

Thank you for this additional information. This will allow me to disable a standard reporting rule when needed. Well, this forum rocks !

You can also say:

The new report touching things rule is listed instead of the report touching things rule in the report touching rulebook.

Or just put at the end of your rule:

rule succeeds.

Which says to stop the rulebook and not run any further rules.

1 Like

Well, before I posted here, I wanted to try first the “rule succeeds” method, because I prefer not to change the Standard Rules if I can. So I put it at the end of my carry out rule. I just realized thanks to your reply that I have to put it at the end of my report rule, due to the turn sequence I assume. Clearly, there are a lot of things to understand to make this little adjustment…

1 Like
Check touching something (this is the F030 - Check touching something rule):
	if (the noun is the imperial sword):
		say "When you touch your imperial sword, the blade feels strangely warm, offering a reassuring yet stern sensation under your fingers." instead;
	otherwise if (the noun is a lit firebased-lighting-tool):
		say "You wouldn't want to get burned..." instead;
	otherwise:
		continue the action;

A small point: you never need continue the action at the end of a Before, Check, Carry Out, or Report rule. All of those can be imagined as having an implicit continue the action at the end, just like After and Instead have an implicit stop the action at the end.

Since both your Check and Carry Out rules are just about outputing some particular message, I wouldn’t implement them as Check or Carry Out. In a test program or a small game, this seems like a persnickety distinction, but developing habits about where to put what kind of rule will pay dividends as the game grows larger just in terms of surprising yourself less as future-you tries to figure out what past-you did and why.

Since After rules automatically stop the action, they can be a convenient place to put alternative output while allowing you to not worry about explicitly deactivating the default report rule in most cases. For instance,

After touching the imperial sword, say "When you touch your imperial sword, the blade feels strangely warm, offering a reassuring yet stern sensation under your fingers.". [ I'll ask, though, whether it should still say "your" if the player has dropped it ]

After touching a a lit firebased-lighting-tool, say "You wouldn't want to get burned...".

After touching when the noun is made of iron or the noun is made of steel, 
say "When you touch [the noun], it feels cold, hard, and unyielding under your fingers. [run paragraph on]".

After touching when the noun is made of wood, say "When you touch [the noun], it feels warm, smooth, and slightly textured under your fingers. [run paragraph on]".

The report touching things rule response (A) is "[touch of the noun] [run paragraph on]".

Notice that the above makes for shorter rules (I find that easier to read and understand).

In the Report rulebook or a Carry Out rulebook, ‘stop the action’ means “cease following this rulebook” but doesn’t stop the action. It’s a somewhat academic distinction in the Report case, 'cause it’s the last action rulebook.

Since <phrase> instead or instead <phrase> is the equivalent of <phrase>; stop the action the following would be equivalent to the above…

Report touching the imperial sword: instead say "When you touch your imperial sword, the blade feels strangely warm, offering a reassuring yet stern sensation under your fingers.". [ I'll ask, though, whether it should still say "your" if the player has dropped it ]

Report touching a a lit firebased-lighting-tool: instead say "You wouldn't want to get burned...".

Report touching when the noun is made of iron or the noun is made of steel: 
instead say "When you touch [the noun], it feels cold, hard, and unyielding under your fingers. [run paragraph on]".

Report touching when the noun is made of wood: instead say "When you touch [the noun], it feels warm, smooth, and slightly textured under your fingers. [run paragraph on]".

The report touching things rule response (A) is "[touch of the noun] [run paragraph on]".
2 Likes

Your teachings are invaluable; thank you for guiding my code toward best practices. Fortunately for me, most of the actions in my WIP don’t primarily involve producing text. Of the alternatives you suggested, I prefer using ‘report’ rather than ‘after’ whenever possible in order to stick to the check - carry out - report triptych for each action. On this subject, one of my challenges is using ‘report’ rules for displaying the results of the player’s actions. Often, my carry out rules delegate routines to phrases that deliver the displayed text, among other activities. But I will definitely take your advice to heart, as it will help me clarify my code.

(The imperial sword is a unique object in my background which, contrary to what one might think, is part of a detective game with little to no combat).

1 Like

First feedback: what you suggested seems to unlock most of my difficulties regarding action programming, even when it comes to specializing the report rules for displaying everything that needs to be shown to the player. Indeed, by applying your recommendations on using report rules, I realized that I had sometimes used action variables like this: The [actionname] action has a number/object called [varname], which allows for declaring variables applicable to the entire action process and ultimately constructing a report rule that utilizes them.

Thank you for repositioning my question in a more general context, which forced me to think in the right direction.

1 Like