First draft of an Inform 7 Storylets Prototype

So, the same experiment with rules:

"Quick very dirty tiny-QBN experience with rules and ghosts" by Monsieur HUT

After printing the banner text:
say "The Wacky the dog dog leaves the location when the player enters the area holding a stick. Its location alternates between the abandoned garden and the woods. The cat enters the abandoned garden if the Wacky the dog hasn’t been in the garden for 3 turns and if both of its cork toys are present. The cat leaves the garden and becomes untraceable if either of the previous conditions is no longer met. The gardener’s ghost enters the abandoned garden if the cat hasn’t been there for at least four turns (as he’s allergic to cats) and if 3 alcoholic beverages are placed on the table in the abandoned garden. The gardener’s ghost leaves the abandoned garden if either of the previous conditions is no longer met. The abandoned garden is cleaned if the gardener’s ghost remains there for 5 consecutive turns and the Wacky the dog isn’t present during this time. Finally, the Grey Lady’s specter enters the abandoned garden if it has been cleaned for 10 turns and her cat is there.";
say "[line break]";

Part 1 - Places, people and things

The village square is a room.
Your house is north of the village square.
The wood is north of your house.
The main street is east of the village square.
The abandoned garden is east of the main street.

The hideout is a room.

A room can be clean or dirty.
The abandoned garden is dirty.

A stick is in the wood.

A toy is a kind of thing.
A cork mouse is a toy in the main street.
A cork butterfly is a toy in your house.

A bottle is a kind of thing.
A bottle of cider is a bottle in your house.
A bottle of wine is a bottle in your house.
A bottle of beer is a bottle in your house.

A small wrought iron table is a supporter in the abandoned garden.
Understand "table" as a small wrought iron table.

The Grey Lady's specter is a person.
The Old Gardener's ghost is a person.
Wacky the dog is a person in the abandoned garden.
Sneaky the cat is a person in the village square.

Part 2 - Counters

NoDog is a number that varies.
NoDog is initially 0.

NoCat is a number that varies.
NoCat is initially 10.

GardenerWorking is a number that varies.
GardenerWorking is initially 0.

CleanGarden is a number that varies.
CleanGarden is initially 0.

HowManyToys is a number that varies.
HowManyToys is initially 0.

HowManyBottles is a number that varies.
HowManyBottles is initially 0.

Part 3 - Rules

Every turn (this is the Every turn - QBN rule):
	follow the dog move rulebook;
	follow the cat toys rulebook;
	follow the cat move rulebook;
	follow the nice bottles rulebook;
	follow the gardener move rulebook;
	follow the garden maintenance rulebook;
	follow the revelation rulebook;

The dog move rules is a rulebook.

A dog move rule:
	if (the player is carrying a stick) and (the player is in the abandoned garden) and (Wacky the dog is in the location):
		perform storylet01;
		
A dog move rule:
	if (the player is carrying a stick) and (the player is in the wood) and (Wacky the dog is in the location):
		perform storylet02;
		
A dog move rule:
	if (Wacky the dog is not in the abandoned garden):
		now NoDog is (NoDog + 1);
		
A dog move rule:
	if (Wacky the dog is in the abandoned garden):
		now NoDog is 0;

The cat toys rules is a rulebook.

A cat toys rule:
	now Howmanytoys is (the number of toys in the abandoned garden);

The cat move rules is a rulebook.

A cat move rule:
	if (Sneaky the cat is not in the abandoned garden) and (NoDog  >= 3) and (HowManyToys is 2):
		perform storylet03;
		
A cat move rule:
	if (Sneaky the cat is in the abandoned garden):
		if (NoDog  < 3) or (HowManyToys < 2):
			perform storylet04;
		
A cat move rule:
	if (Sneaky the cat is not in the abandoned garden):
		now NoCat is (NoCat + 1);
		
A cat move rule:
	if (Sneaky the cat is in the abandoned garden):
		now NoCat is 0;
		
The nice bottles rules is a rulebook.
	
A nice bottles rule:
	now HowmanyBottles is (the number of bottles on the small wrought iron table);
	
The gardener move rules is a rulebook.

A gardener move rule:
	if (The Old Gardener's ghost is not in the abandoned garden) and (NoCat >= 4) and (HowmanyBottles >= 3):
		perform storylet05;
		
A gardener move rule:
	if (The Old Gardener's ghost is in the abandoned garden):
		if (NoCat < 4) or (HowmanyBottles < 3):
			perform storylet06;
		otherwise:
			now GardenerWorking is (GardenerWorking + 1);
			
The garden maintenance is a rulebook.

A garden maintenance rule:
	if (GardenerWorking >= 5) and (NoDog  >= 5):
		perform storylet07;
		
A garden maintenance rule:
	if (the abandoned garden is clean):
		now CleanGarden is CleanGarden + 1;
		
The revelation is a rulebook.

A revelation rule:
	if (CleanGarden >=  10) and (Sneaky the cat is in the abandoned garden):
		perform storylet08;
		
Part 4 - Storylets

To perform storylet01:
	say "As you enter the place, the dog, noticing the stick in your hand, quickly scurries away, keeping several meters between you. Yet, you have never struck anyone. He flees towards the village square.[line break]";
	move Wacky the dog to the wood;
	
To perform storylet02:
	say "As you enter the place, the dog, noticing the stick in your hand, quickly scurries away, keeping several meters between you. Again ! He flees towards the abandoned garden.[line break]";
	move Wacky the dog to the abandoned garden;
	
To perform storylet03:
	say "Sneaky the black cat calmly enters the garden. He lies down in the grass and begins to play with his cork mouse.[line break]";
	move Sneaky the cat to the abandoned garden;
	
To perform storylet04:
	say "Suddenly, Sneaky the cat passes between your feet and rushes to head one of its favorite unknown places.[line break]";
	move Sneaky the cat to the hideout;	
		
To perform storylet05:
	say "The gardener's ghost enters the garden, whistling with a rake over his shoulder. He starts tidying up the garden, casting frequent glances at the bottles of wine he can no longer drink.[line break]";
	move the Old Gardener's ghost to the abandoned garden;
		
To perform storylet06:
	say "The ghost of the gardener begins to sneeze violently, scattering ethereal droplets in a bluish halo. 'Cursed cat!' he rages, before leaving this place. 'Sure it's roaming in the area'[line break]";
	move the Old Gardener's ghost to the hideout;
	now GardenerWorking is 0;

To perform storylet07:
	now the description of the abandoned garden is "The garden now appears completely tended: the lawn is mowed, the hedges are trimmed, and the leaves are gathered. A faint scent of camphor lingers in the air.[line break]";
	now the abandoned garden is clean;
	repeat with LocalBottle running through bottles:
		move LocalBottle to the hideout;
	move the Old Gardener's ghost to the hideout;
	if the player is in the abandoned garden:
		try looking;

To perform storylet08:
	if the player is not in the abandoned garden:
		say "You hear something strange from the east garden";
	if the player is in the abandoned garden:
		say "A breeze stirs as a spectral figure with a slender silhouette drifts into the space, subtly gliding between the plants. It’s the Grey Lady, who rarely graces the villagers with her unsettling yet benevolent presence.[line break]";
		end the story.

It’s very rudimentary, but I think it is still compliant with the QBN spirit. The story progresses based on how the player is able to modify the parameters and values of the world model.
Depending on the resulting configuration, certain events are triggered, deactivated, or countered by opposing events. The player does not navigate a fixed branching model, even if they can trigger irreversible events. Thinking about this, it seems to me that the rule-based orientation of Inform 7 predisposes and encourages this approach, especially for narrative aspects.

Additional lesson for myself: go easy on the tables, much stronger on the rules.

EDIT : special thanks to @Draconis for having mentioned the rulebooks.

1 Like