A lighter shade of Darkness

This is my first attempt at a type of “darkness” that might be more useful for storytelling than the ordinary kind. If I’ve got the markup right, then you should be able to copy it to the clipboard, paste it into inform and it should compile into a playable little mini-game. I’d appreciate any thoughts and comments.

Mostly though, I hope you enjoy it.

Source text:

"A lighter shade of Darkness" by "Justaguy"


Volume - Set up

Size is a kind of value. The sizes are normal-size, and small. Every thing has a size. A thing is usually normal-size. 

A room can be dim.
[It's up to the writer to decide how dim that is. The default assumption is that normal things are big enough to be vaguely (but not fully) seen in a dim room. Small things are too small for even a vague impression to register. Scenery will not be mentioned unless it is a supporter and has something on it that is normal-sized.]

A room has some text called dimtext. The dimtext of a room is usually "Error: Dimtext not written for this location."
[This is essentially an alternate room description.]

A thing has some text called dimness appearance. The dimness appearance of a thing is usually "".
[This is essentially an initial appearance that will only be shown in a dim room. A thing can have both an initial appearance and a dimness appearance.]


Player-enlightenment is a truth state that varies.

To set player-enlightenment:
	if the player can see a lit thing:
		now player-enlightenment is true;
	else:
		now player-enlightenment is false;
		
Book - Examining & Searching

[Basically, switch them off. Easy to write your own versions if you want.]

Check examining something when player-enlightenment is false:
	if the noun is small:
		say "Being so small, [the noun] eludes you in the dark." instead;
	otherwise:
		say "You can barely make out [the noun] in the gloom." instead.

Check searching something when player-enlightenment is false:
	say "The light's too poor right now to see anything beyond vague shapes, really." instead. 

[We always update player-enlightenment for the current location even if it's an ordinary room, since the locale rules look at it too.]
This is the enhanced room description body text rule:
	set player-enlightenment;
	if the location is a dim room:
		if player-enlightenment is true:
			say the description of the location;
		else:
			say the dimtext of the location;
	else:
		say the description of the location;
	say "[paragraph break]";
		
The enhanced room description body text rule is listed instead of the room description body text rule in the carry out looking rulebook.

Book - Two giant locale routines
[Copied, very carefully, from the standard rules -- and then messed around with.]

For printing a locale paragraph about a thing (called the item) (this is the use initial appearance or dimness appearance in room descriptions rule):
	if the item is not mentioned:
		if player-enlightenment is true:
			if the item provides the property initial appearance and the item is not handled and the initial appearance of the item is not "":
				increase the locale paragraph count by 1;
				say "[initial appearance of the item]";
				say "[paragraph break]";
				if a locale-supportable thing is on the item:
					repeat with possibility running through things on the item:
						now the possibility is marked for listing;
						if the possibility is mentioned:
							now the possibility is not marked for listing;
					say "On [the item] ";
					list the contents of the item, as a sentence, including contents, giving brief inventory information, tersely, not listing concealed items, prefacing with is/are, listing marked items only;
					say ". [paragraph break]";
				now the item is mentioned;
		else:
			if the item provides the property dimness appearance and the item is not handled and the dimness appearance of the item is not "":
				increase the locale paragraph count by 1;
				say "[dimness appearance of the item]";
				say "[paragraph break]";
				if a locale-supportable thing is on the item:
					repeat with possibility running through things on the item:
						now the possibility is marked for listing;
						if the possibility is mentioned:
							now the possibility is not marked for listing;
						if the size of the possibility is small:
							now the possibility is not marked for listing;
					say "On [the item] ";
					list the contents of the item, as a sentence, including contents, giving brief inventory information, tersely, not listing concealed items, prefacing with is/are, listing marked items only;
					say ". [paragraph break]";
				now the item is mentioned;
	continue the activity;

The use initial appearance or dimness appearance in room descriptions rule is listed instead of the use initial appearance in room descriptions rule in the for printing a locale paragraph about rulebook.

[The whole point of having sizes is so that by making something small, it won't show up in a dim room. It's still in scope, though.]

Before listing nondescript items:
	if player-enlightenment is false:
		now every small thing in the location is mentioned;


For printing the locale description (this is the you-cant-also-see-much-when-its-dim rule):
	let the domain be the parameter-object;
	let the mentionable count be 0;
	repeat with item running through things:
		now the item is not marked for listing;
	repeat through the Table of Locale Priorities:
		[say "[notable-object entry] - [locale description priority entry].";]
		if the locale description priority entry is greater than 0,
			now the notable-object entry is marked for listing;
		increase the mentionable count by 1;
	if the mentionable count is greater than 0:
		repeat with item running through things:
			if the item is mentioned:
				now the item is not marked for listing; 
			if player-enlightenment is false and the size of the item is small:
				now the item is not marked for listing;	[addition to standard rule here.]
		begin the listing nondescript items activity with the domain;
		if the number of marked for listing things is 0:
			abandon the listing nondescript items activity with the domain;
		otherwise:
			if handling the listing nondescript items activity:
				if the domain is a room:
					if the domain is the location, say "You ";
					otherwise say "In [the domain] you ";
				otherwise if the domain is a supporter:
					say "On [the domain] you ";
				otherwise if the domain is an animal:
					say "On [the domain] you ";
				otherwise:
					say "In [the domain] you ";
				[say "can [if the locale paragraph count is greater than 0]also [end if]see ";]
				if player-enlightenment is true:
					say "can [if the locale paragraph count is greater than 0]also [end if]see ";
				otherwise:
					say "can barely [if the locale paragraph count is greater than 0]also [end if]make out  the outline[s] of "; [addition to the standard rule] 
				let the common holder be nothing;
				let contents form of list be true;
				repeat with list item running through marked for listing things:
					if the holder of the list item is not the common holder:
						if the common holder is nothing,
							now the common holder is the holder of the list item;
						otherwise now contents form of list is false;
					if the list item is mentioned, now the list item is not marked for listing;
				filter list recursion to unmentioned things;
				if contents form of list is true and the common holder is not nothing,
					list the contents of the common holder, as a sentence, including contents, giving brief inventory information, tersely, not listing concealed items, listing marked items only;
				otherwise say "[a list of marked for listing things including contents]";
				if the domain is the location, say " here";
				say ".[paragraph break]";
				unfilter list recursion;
			end the listing nondescript items activity with the domain;
		rule succeeds;


The you-cant-also-see-much-when-its-dim rule is listed instead of the you-can-also-see rule in the for printing the locale description rulebook.



Volume Geography

[This is an ordinary lighted room, with no fancy business.]
The Hallway is a room. "Lit by a cobwebbed chandelier, the hallway is a monument to the taste of a century ago. Or possibly two. A dry murmur comes through  the library doorway to the south, and from the dark doorway to the north comes an insidious, saline scent."

The cobwebbed chandelier is scenery in the hallway.

Instead of listening to the hallway, say "You've been warned not to. In your family eavesdropping gets you rather more than a slap on the wrist."

Instead of smelling in the hallway, say "Rather too reminiscent of the candies Aunt Elzira used to find in her cardigan for you."

A heavy table is in the hallway. A brass lantern is on the table. The brass lantern is lit. Understand "lamp" or "light" as the brass lantern.
[I've deliberately left the heavy table not fixed in place so you can to mess around with it if you like.]

A detector is on the table. "An ornate brass box with a lever shaped like a gnomon, and [italic type]'Kraken ye see, Kraken ye flee!'[roman type] engraved on the side[if the holder of the detector is not the location] sits on [the holder of the detector] at the side of the hall[end if][if the number of unmentioned things on the holder of the detector is greater than 0], together with [a list of unmentioned things on the holder of the detector][end if]." The detector is small.
Understand "brass", "box", "gnomon", "kraken detector", "ornate" or "lever" as the detector.

Instead of pushing the detector:
	say "The pointed lever digs cruelly into your thumb.";
	if the player can see the kraken:
		say "BEEP! BEEP! BEEP! BEEP![line break]Kraken!";
	else:
		say "Boop Boop Boop.[line break]Kraken-free zone.";

A small wooden chest is in the hallway. "A small wooden chest, pushed against the opposite wall, does duty as an uncomfortable seat. Aunt Elzira never encouraged visitors." The wooden chest is a container. It is openable and closed.

Instead of entering the small wooden chest, say "You have enough uncomfortable memories."

[Okay. The dim room is where we can have all the spooky fun.]

The conservatory is north of the hallway. "[conservatorydesc]."
The conservatory is dim.
The dimtext of the conservatory is "In the deep gloom, you can barely discern anything."

Instead of going outside in the conservatory, try going south.
 
To say conservatorydesc:
	say "The tall, moisture fogged windows weep greenish drops and are overgrown with serpentine vegetation;  the walls are painted a dark gray-green, and hardly adorned by what's hanging on one of them";
	now the strangling vines are mentioned;

The strangling vines are in the conservatory. Understand "serpentine" as the strangling vines.
The dimness appearance of the strangling vines is "In the shadows,  serpentine movement. "
[the strangling vines can't be scenery if they're to have a dimness appearance (well, it'll still compile, but they won't show up,) so making them mentioned avoids having "You can see some strangling vines here" bunged on the end of the room description.]
 
The ugly armchair is an enterable supporter in the conservatory.

The portrait is in the conservatory. The description of the portrait of your aunt elzira is "She's grimacing at the artist as she receives her 'Wartiest Wart' award." Understand "picture", "aunt" or "Elzira" as the portrait.

The initial appearance of the portrait is "From above the marble fireplace the portrait of your aunt Elzira glares down at you."

The marble fireplace is scenery in the conservatory. The description of the marble fireplace is "Hideous."

The aquarium tank is an enterable container in the conservatory. "The aquarium stands with its lid off, half full of water,  innocent of its captive." Understand "blue" or "glass" as the aquarium.
The dimness appearance of the aquarium tank is "[one of]For a moment, against the faintly blue glass of an aquarium, you glimpse a couple of tentacles[or]The aquarium glass glows faintly blue[stopping]."

[Check entering the aquarium]

A kraken is a male animal in the conservatory. The description of the kraken is "An [italic type]extremely[roman type] juvenile kraken. He's in the will." The kraken is small.
Understand "junior", "tentacle/tentacles", or "juvenile/young" as the kraken.
Understand "Fred" as the kraken when the kraken is proper-named.
The kraken can be active or passive.

The initial appearance of the kraken is "[The kraken]'s tentacles shift minutely as he watches you warily from half way up [the random other object in the conservatory]."

Instead of listening to the kraken:
	say "You hear the slither and pop of moving suckers."
	
Instead of attacking the kraken:
	say "That's a bad idea. Kraken have long memories -- and your family have even longer ones."
	
Persuasion rule for asking the kraken to try entering the aquarium:
	persuasion succeeds;
	
Report the kraken entering the aquarium:
	say "With a resentful wriggle of his blue-gray tentacles, [the kraken] swarms up the side of the aquarium and climbs inside." instead.
	
Check taking the kraken:
	if player-enlightenment is false:
		now the kraken is passive;
		say "[The kraken] slithers away, leaving only a parting gift of slime on your hands." instead;
	
Definition: an object is other if it is not the player.
[This sometimes results in the kraken climbing itself.]

Every turn when the player is in the conservatory:
	if the kraken is in the aquarium:
		end the story saying "You have a sudden feeling you're going to be doing this a lot.";
	if player-enlightenment is false:
		if the kraken is active:
			say "[one of]It sounds like[or]Slithering suggests[or]Subtle movement in the gloom hints[at random] [the kraken] is climbing [the random other object in the conservatory].";
		otherwise:
			now the kraken is active;

Check examining the kraken:
	if player-enlightenment is true:
		now the kraken is proper-named;
		now the printed name of the kraken is "Fred";
		say "Oh! It's [the kraken]!";
		

The library is south of the hallway.  "It's no use: the room's blanked until they've finished reading the will."
The library is dark.

The conference table is in the library.

Instead of going south from the hallway when the player is carrying the brass lantern:
	say "In terrible unison, your relatives turn and glare at you.";
	end the story saying "You have been turned into kraken food.";

test darkness with "s / x table / n / take lamp / s".

test me with " take detector / n / press detector / drop detector / l / x aquarium / x  tentacle / take kraken / s / take lamp /n / x kraken / l / kraken, get in tank".

2 Likes