Separating Carry out and Report functionality best practices

Hi All,

Tinkering with Inform as usual. I understand from the docs I can use properties for kinds. Great! Then I can create mastery levels of kind of things. Here is what I came up with:

This works and allows the player to tinker (and improve mastery of the shape tinkered). However when I try to split the Carry out (updating) and Report (reporting) functionality (commented out in the example above) I get a weird error: *** Run-time problem P10: Since nothing is not allowed the property "tinkered-shape", it is against the rules to try to use it. This is because of the following statement:

	if the tinkered-shape of the noun was tinkered-learned:

As @mathbrush pointed out to me, referring to the past (was) of the noun is a no-no according to the docs. Should I just ignore the Report stage and keep everything at the Carry out stage? Are there other ways to do this kind of thing? What is the best practice here?

Any feedback would be greatly appreciated!

3 Likes

You can use an action variable. This requires explicitly defining the level of tinkering mastery as a kind.

"Tinkering"

Laboratory is a room. "Many devious experiments are conducted here."

A tinkered-metal is a kind of value. The tinkered-metals are copper, iron, and steel.

A tinkered-shape is a kind of value. The tinkered-shapes are pot, kettle, and pan.
A tinkered-level is a kind of value. The tinkered-levels are tinkered-unknown, tinkered-learned and tinkered-mastered.
A tinkered-shape has a tinkered-level called the level.
The level of the pot is tinkered-learned. The kettle has level tinkered-mastered. The pan has level tinkered-unknown.

A tinkerable is a kind of thing. A tinkerable has a tinkered-metal. A tinkerable has a tinkered-shape.

The printed name of a tinkerable is "[tinkered-metal] [tinkered-shape]".
The description of a tinkerable is "[tinkerable-desc].".
To say tinkerable-desc:
	let S be the level of the tinkered-shape of the noun;
	if S is tinkered-unknown:
		say "A [tinkered-metal] [tinkered-shape] you do not know how to tinker";
	otherwise if S is tinkered-learned:
		say "A [tinkered-metal] [tinkered-shape] you think you can tinker";
	otherwise:
		say "A [tinkered-metal] [tinkered-shape] you can tinker confidently"

Understand "tinkerable" as a tinkerable.
Understand the tinkered-metal property as describing a tinkerable.
Understand the tinkered-shape property as describing a tinkerable.

Tinkering is an action applying to one thing.
Understand "tinker [something]" as tinkering.

Check tinkering:
	if the noun does not provide the property tinkered-shape:
		say "You contemplate tinkering with [the noun] but decide against it." instead;
	if the level of the tinkered-shape of the noun is tinkered-unknown:
		say "You have yet to learn how to tinker a [tinkered-shape]." instead;

[Carry out tinkering:
	if the level of the tinkered-shape of the noun is tinkered-learned:
		say "You carefully tinker the [tinkered-shape of the noun], studying and memorizing each step.";
		now the level of the tinkered-shape of the noun is tinkered-mastered;
	otherwise:
		say "You tinker the [tinkered-shape of the noun]."]

The tinkering action has a tinkered-level called original condition.

Before tinkering: 
	now the original condition is the level of the tinkered-shape of the noun;

Carry out tinkering:
	if the level of the tinkered-shape of the noun is tinkered-learned:
		now the level of the tinkered-shape of the noun is tinkered-mastered.

Report tinkering:
	if the original condition is tinkered-learned:
		say "You carefully tinker the [tinkered-shape of the noun], studying and memorizing each step.";
	otherwise:
		say "You tinker the [tinkered-shape of the noun]."


In the laboratory is an oak table.
On the table is a copper pot tinkerable.
On the table is an iron kettle tinkerable.
On the table is a steel pan tinkerable.
5 Likes