Feedback on I7 extension

I’ve just completed an I7 extension called “Dynamic Exposition”, and I’m looking for actual programmers who know something about computers to look at it and tell me it sucks. I wrote it as a foundation for quest journals, and essentially it writes strings to entries (called expositions), allowing the player to keep a sort of database that updates itself as the player encounters and sees things. It also can print announcements when updated, generally in the form of “The entry on XYZ has been updated”. It works fairly well on the examples I wrote for it, but that doesn’t mean there aren’t some obvious mistakes.

I thought, since I couldn’t really find an I7 extension that replicates this function, this might be useful to people in some form. Since this is a creative-commons licensed thing anyway, I might as well just paste the code directly into the forum.

[spoiler][code]Version 1/170712 of the Dynamic Exposition by William S Martin begins here.

“Gives players access to a database that updates dynamically during play and announces modifications to the player. This allows easy implementations of journals, quest logs, the internet, and so forth.”

Include Epistemology by Eric Eve.

Chapter 1 - The Exposition List

All things have a list of texts called an exposition-list.

To decide if the exposition-list of (item - a thing) is blank:
let N be the exposition-list of the item;
let X be the number of entries in N;
if X is 0:
decide yes;
else:
decide no.

Definition: A thing is researchable:
if the exposition-list of it is blank, decide no;
decide yes.

Chapter 2 - Printing the Exposition

The display records rules is a rulebook.

Printing the exposition of something is an activity.

Rule for printing the exposition of something (called the item):
say “You look up information on [the item]:[paragraph break]”;
print the exposition of the item.

To print the exposition of (the item - a thing), as one paragraph:
let the current exposition be the exposition-list of the item;
if as one paragraph:
repeat with X running through the current exposition:
say X;
else:
repeat with X running through the current exposition:
say X;
say “[paragraph break]”.

A display records rule:
carry out the printing the exposition activity with the noun.

Chapter 3 - Writing the Exposition

To write (addition - a text) for the topic (current subject - a thing), silently, at the beginning:
let current exposition be the exposition-list of the current subject;
let N be the number of entries in the current exposition;
if at the beginning:
add addition at entry 1 in the exposition-list of the current subject;
else:
add addition to the exposition-list of the current subject;
if silently:
do nothing;
else:
mark current subject for announcement.

Chapter 4 - Researching action

Researching it on is an action applying to one visible thing and one touchable thing.

A thing can be expository. A thing is usually not expository.

Does the player mean researching something on an expository thing: it is very likely.

Rule for deciding the scope of the player while researching:
repeat with X running through known things:
place X in scope.

Understand “read about [something] in [something]” as researching it on when the second noun is an expository thing. Understand “look up [something] in [something]” as researching it on when the second noun is an expository thing. Understand “consult [something] on/about [something]” as researching it on (with nouns reversed) when the second noun is an expository thing. Understand "read [something] in [something]"as researching it on when the second noun is an expository thing. Understand “research [something] on/about [something]” as researching it on (with nouns reversed). Understand “research [something] in [something]” as researching it on.

Understand “research on/about/-- [something]” as researching it on. Understand “read on/about/-- [something]” as researching it on. Understand “look up [something]” as researching it on. Understand “r [something]” as researching it on.

Check researching it on (this is the only can research on an expository thing rule):
if the second noun is not an expository thing:
say “You can’t use [the second noun] like that.” instead.

Check researching it on (this is the only can research researchable objects rule):
if the noun is not researchable:
say “There is no entry about that.” instead.

Report researching it on:
follow the display records rulebook.

The default-expository is a thing that varies.

Rule for supplying a missing second noun while researching:
let N be the default-expository;
now the second noun is N.

Chapter 5 - Reporting Additions to the Expository

The announcement queue is a list of objects that varies.

To mark (item - a thing) for announcement:
if the item is not listed in the announcement queue:
add item to the announcement queue.

Carry out looking (this is the mark items to expository announce when looking rule):
unless in darkness:
repeat with item running through things that are enclosed by the location:
if the item is not enclosed by an opaque closed container:
if the item is unseen and the item is researchable:
mark item for announcement.

The mark items to expository announce when looking rule is listed before the mark items as seen when looking rule in the carry out looking rules.

Carry out opening a container (this is the mark items to expository announce on opening a container rule):
repeat with item running through things that are enclosed by the noun:
if the item is unseen and the item is visible:
if the item is researchable:
mark item for announcement.

The mark items to expository announce on opening a container rule is listed before the mark items as seen on opening a container rule in the carry out opening rules.

Toggle expoannouncements is a truth state that varies. Toggle expoannouncements is usually false.

Printing the expository announcement of something is an activity.

Rule for printing the expository announcement of something (called the subject announced):
say “[italic type]New information on '”;
carry out the printing the name activity with subject announced;
say “’ has been added to the records.[roman type]”

This is the notify expository changes rule:
if the toggle expoannouncements is true:
repeat with current subject running through announcement queue:
carry out the printing the expository announcement activity with the current subject;
repeat with current subject running through announcement queue:
remove current subject from announcement queue;
rule succeeds.

The notify expository changes rule is listed after the note object acquisitions rule in the turn sequence rules.

Version 1/120715 of Dynamic Exposition ends here.

---- DOCUMENTATION ----

Dynamic Exposition adds a dynamic database system that can be used as the basis to implement a variety of things. For example:

A) Journals, notebooks and so forth that records the player character’s thoughts and observations during play.

B) The internet, magical enyclopedias, crystal balls, Akashic records or any other device with access to a highly dynamic source of information.

C) The player’s thoughts and memories that change over time.

D) A quest log, that keeps track of things that a character needs to do. The example, the Adventures of Glubby, provides a basic framework for a quest log.

Some of these can be implemented with almost no work. For others, some assembly is required.

KNOWN ISSUE - When a researchable object is in the first room on the first turn, the game tends to print an announcement of it the turn afterward. The workaround for this is to mark the object as “seen” before the game starts, which will suppress the announcement.

Chapter: Setting up Dynamic Expositions

Dynamic journaling requires a bit of work to get full use out of it. In most circumstances, it will be better just to use the consult command to get what we need.

First, we need an expository thing. The expository thing is needed by the player to access the database. Keep in mind all expository things have access to the same database, no matter what. So it would make sense for an iPad, a computer and a smart phone to all be expository things, but it would make no sense at all for Jack’s diary and Bill’s notebook to both be expository things.

The audio recorder is here. It is expository.

Everything will now also have a list of texts called a exposition-list. This is what is printed when the researching action is finished.

The salmon is a thing. The exposition-list is {"Salmon are a sort of fish that like to swim upriver."}

The exposition-list by default is blank. The extension defines anything with a non-empty exposition-list as researchable, allowing us to make lists of researchable objects.

The index is a subject. The exposition-list is {"[list of researchable things]"}.

This allows the player to write something like LOOK UP INDEX IN BOOK and get everything the book expounds upon.

Also, it is recommended that we make at least one expository thing the default-expository. When a player doesn’t provide a second noun by default it will pick the default-expository.

This allows the player to write things like RESEARCH CHUPACABRA or even R CHUPACABRA without needing to type in something like RESEARCH DIARY ABOUT CHUPACABRA every time.

Chapter: Accessing and Writing to the Exposition

The exposition-list is “read” by using the a new researching action.

Instead of consulting the necronomicon about death, try researching the necronomicon about death.

What might the output of the above be?

You look up information on death. It reads:

"Death is a beginning and not an end"

The first part, “You look up information on death. It reads:” is not part of the exposition-list entry of the second noun. It is a text that is printed whenever the exposition is accessed and allows the us to introduce the text. This can be customized later.

The second part is the actual exposition-list entry of the second noun.

We may also make dynamic additions to any recordall text with the phrase “write (a text) for the topic (thing)”

Let’s say that the player discovers some terrible secret about death:

After consulting the encyclopedia about death for the first time, write "Legal death is when your heart stops." for the topic death.

This adds a new paragraph to your exposition for death. In general, it is a good idea to make this phrase a one-off. Doing it repeatedly for the same action is a recipe for disaster.

Before going somewhere, write "Enough of these and you'll have a massive, unreadable mess." for the topic recipe for disaster.

We do not want the above.

This phrase also has a number of options.

write "Drink to your health." for the topic beer, silently.

The “silently” option suppresses the modification announcement cause by the use of the “write” phrase. More is written about this in Chapter 4 - Announcement of Entries.

write "Drink to your health." for the topic beer, at the beginning.

By default, the phrase puts the new addition at the end of the exposition-list. This instead tacks it in the beginning.

NOTE: While the consulting and researching action use the same commands, the extension attempts to understand when you want to use the researching action and the consulting action. This extension by no means replaces the consulting action.

You can use the consulting action to simulate more static databases, like a mundane, papery encyclopedia, and still have the function of the expository.

The magic encyclopedia an expository thing.

The mundane encyclopedia is a thing.

So long as either one or the other is in scope, the game will generally understand which action to use with CONSULT THE ENCYCLOPEDIA ABOUT DRAGONS. If they are both in scope, you might want to clarify with some contextual understand commands.

Chapter: Customizing the Output

The way which expositions are displayed can be very heavily customized. The Mysteries of Mars example shows you how you can customize messages depending on what object is being expositioned about.

Rule for printing the exposition of a planet (called the current planet):
	say "Classification: [classification of current planet][paragraph break]Diameter: [diameter of the current planet][paragraph break]Gravity: [gravitation pull of current planet][pargraph break]Average Temperature: [temp of current planet][paragraph break]Current records of planet:[paragraph break]";
	print the exposition of the current planet;
	say "END TRANSMISSION".

Whenever a new rule is written for the exposition of something, it should include the phrase “print the exposition of…”

By default, each new entry is printed as a seperate paragraph. We can, however, choose to group it in just a single paragraph by using the “as one paragraph” option with the “print exposition of” phrase.

Rule for printing the exposition of a hastily scribbled thing (called the item):
	print the exposition of the item, as one paragraph.

Chapter: Announcements of Entries

Dynamic Exposition has the capacity to print an announcement every time something is written to it. By default, it is turned off, so if the feature doesn’t appeal to us, we don’t need to worry about this section at all.

If, however, we do want to play around with it, we can write in our code:

*:

The toggle expoannouncements is true.

This activates the announcement system. Every time a player sees a researchable thing for the first time, or a new entry is written to the announcement system, the game will print an announcement declaring new information is available on that subject.

If we only want certain items to be announced, we can make a new rule for items we don’t want announced and leave them blank.

Rule for printing the expository announcement of an unimportant thing:
	do nothing.

The second way we can suppress a expository announcement is to use the “silently” option on the “write (text) for the topic (thing).”

We can use the same rule to play around with announcements for different things:

Rule for printing the expository announcement of an unfortunate thing:
	say "As you're writing the entry in the journal, you prick your finger with the nib of your pen.";
	now the player is bleeding.

This will replace the standard expository announcement and replace it with this text, in addition to making the unfortunate player bleed.

Example: ** Mysteries of Mars - Implements a very simple dynamic journal system where scanning an object writes a text to the exposition of an object. Also, demonstrates how you can vary exposition outputs and announcements depending on the object.

*: “Mysteries of Mars”

[First we craft Mars, with the magic of interactive fiction.]

The rocky hills are a room. South of the rocky hills is the martian base. North of the rocky hills is the martian desert. North of the martian desert are the craggy cliffs. North of the craggy cliffs are the ice caps.

The player is in the martian base. The player is carrying a scanotron.

The player is carrying an info-display. The info-display is an expository thing.

The default-expository is the info-display.

The toggle expoannouncements is true.

The hab-tech is a thing. It is in the martian base. It is fixed in place. It is seen. The exposition-list is {"You live in a hab-tech. They are quite plain on the inside."}. The scanned information is "Your scanotron tells you that the hab-tech is mostly made of titanium.".

Some fascinating rocks are a thing. It is in the rocky hills. The exposition-list is {"The rocks have fascinating flecks of color in them. You must investigate them."}. The scanned information is "Scans indicate high levels of crystal formations that are causing the flecks of color."

The petrified plant is a thing. It is in the martian desert. The exposition-list is {"Embedded in a rock you can see what you believe to be are ancient fronds."}. The scanned information is "Scans indicate amino acids in the rock. Your hunch about them being fossils is correct."

The massive crystal is a thing. It is fixed in place. It is in the craggy cliffs. The exposition-list is {"You discovered this fascinating blue crystal in the rocky hills."}. The scanned information is "You detected carbon within the crystals."

The alien artifact is a thing. It is fixed in place. It is in the ice caps. The exposition-list is {"The ancient (presumably Martian) baton-looking object is just a featureless metal tube."}. The scanned information is "When you scanned the object, it produced what looks like an alien script. Fascinating."

[The scanotron is our expository device here. We can create the illusion that the player is accessing an amazing hi-tech device with some rules]

Rule for printing the exposition of something when the second noun is an info-display:
	say "[italic type]You search for '[the noun]' in the info-display. It prints:[roman type][paragraph break]";
	print the exposition of the noun;
	say "END TRANSMISSION".

[To be especially dramatic, we can use a rule for a particular artifact the player finds.]

Rule for printing the exposition of the alien artifact when the second noun is an info-display:
	say "Your info-display is nearly smoking as you access information on the alien artifact.... [paragraph break]";
	print the exposition of the alien artifact;
	say "END TRANSMISSION".

Rule for printing the expository announcement of something (called the item) when the player carries an info-display:
	say "[italic type]Your info-display beeps with new information on [the item][roman type]."

Rule for printing the expository announcement of something (called the item) while scanning and the player carries an info-display:
	say "[italic type]New information on [the item] has been uploaded from the scanotron[roman type]."

Rule for printing the expository announcement of the alien artifact while the player carries an info-display:
	say "BZZT! Your info-display suddenly goes haywire! It calms after a moment."

Section: Scanning

[Next we define scanning. Scanning is action that adds a string to the expository-list.]

Scanning is an action applying to one visible thing.

Understand "scan [something]" as scanning.

Check scanning:
	if the actor is not carrying a scanotron:
		say "You can't scan without a scanotron." instead.

Check scanning:
	if the noun is scanned:
		say "Your scanner detects nothing new." instead.

Check scanning:
	if the noun is not researchable:
		say "That object isn't interesting to scan." instead.

Carry out scanning:
	let N be the scanned information of the noun;
	write N for the topic noun;
	now the noun is scanned.

A thing has a text called scanned information.
A thing can be scanned or unscanned. A thing is usually not scanned.

Test me with "r hab-tech / scan hab-tech / r hab-tech / n / n / n / n / r artifact / scan artifact / r artifact"

Example: *** The Adventures of Glubby - Uses the dynamic journal system as the basis for a very simple quest log, like what is found in other games. This takes record of tasks that need to be done.

*: “The Adventures of Glubby”

Section: Rules

[First, we have to turn on expository announcements]

The toggle expoannouncements is true.

[Next, we define a quest, and a number of phrases to help use manage quests]

A quest is a kind of subject. A quest can be inactive, newly started, started or finished. A quest is usually inactive.

To update (current quest - a quest) with (addition - a text):
	if the current quest is not started:
		do nothing;
	else:
		write addition for the topic current quest.

To complete (current quest - a quest) with (addition - a text):
	if the current quest is not started:
		do nothing;
	else:
		write addition for the topic current quest;
		now the current quest is finished.

To start (current quest - a quest) with (addition - a text):
	if the current quest is not inactive:
		do nothing;
	else:
		write addition for the topic current quest;
		now the current quest is newly started.

[To give the player encouragement, everything he does will be announced with much fan-fare.]

Rule for printing the exposition of a quest (called the current quest):
	say "DUM-dee-dee-DUM! The epic [current quest] is [if current quest is started]underway[else]completed[end if]! Here is a list of your mighty achievements thus far...[paragraph break]";
	print the exposition of current quest.

Rule for printing the expository announcement of a newly started quest (called the current quest):
	say "DUM-dee-dee-DUM! You have a new quest... [the current quest]!";
	now the current quest is started.

Rule for printing the expository announcement of a started quest (called the current quest):
	say "DERP-dee-dee-DOO! You have exquisitely advanced [the current quest]!"

Rule for printing the expository announcement of a finished quest (called the current quest):
	say "DERP-dee-dum-DOO-dee-dum-DEE! You have completed [the current quest]!"

[But how will the player learn of their mighty deeds? A quest journal, of course.]

The quest log is a subject.

Instead of researching the quest log on something:
	say "Current quests: [list of started quests]";
	say "[paragraph break]";
	say "Completed quests: [list of finished quests]".

Section: The Scenario

[Now let's build this world]

The forest is a room. East of the forest is the mill. Inside of the mill is the mill interior.

The quest journal is a thing. It is expository. The player is carrying the quest journal.

The default-expository is the quest journal.

The apple is a thing.

The barrel is a container. It is open. It is in the forest.

The player is in the forest.

After going to the mill for the first time:
	Update Visit the Mill with "You have strode through the forest toward the mill. All that is left is to go inside the mill."

After going to the mill interior for the first time:
	complete visit the mill with "Bravely, you have entered the mill, and even assigned to a new, even more glorious task!";
	say "You enter the mill, screaming with triumph. Suddenly the miller appears out of nowhere, saying breathlessly, 'Good sir! I need an apple placed in a barrel in the forest! This is an important task... do you think you can do it for me?'[paragraph break]Before you have a chance to respond, he tosses you a glossy, red apple, and then leaves immediately.[paragraph break]You're about to undertake the task, you hear his voice: 'Whatever you do, don't drop the apple!'";
	start put-apple-in-barrel with "The miller has given you the mighty task to put an apple inside a barrel. He specifically asked you not to drop the apple.";
	now apple is in the player.

When play begins:
	say "You have a valiant quest... to visit the mill east of the river!"

[Let's defint our quests. In the beginning, the only active quest is to visit the mill. Thus, we define it as "started".]

There is a quest called Visit the Mill. The printed name is "the quest to visit the mill". The exposition-list is {"You bequeathed upon yourself the quest to visit the mill."}. It is started.

Understand "quest to visit the mill" as visit the mill.

There is a quest called Put-Apple-in-Barrel. The printed name is "the quest to put the apple in the barrel".

Understand "put apple in barrel" as put-apple-in-barrel.

After going to the mill while the player is carrying an apple for the first time:
	update put-apple-in-barrel with "You have strode with alacrity across with the apple."

After going to the forest while the player is carrying an apple for the first time:
	update put-apple-in-barrel with "Amazing! You are almost there! Now just put the apple in the barrel."

After inserting the apple into the barrel for the first time:
	complete put-apple-in-barrel with "You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! The miller will be so happy!"

After dropping the apple for the first time:
	say "Nooooo! you dropped the apple!"
	complete put-apple-in-barrel with "You insolent worm! You dropped the apple! Now the miller will be in despair!"

test me with "r quest log / e / r visit the mill / go inside / r visit the mill / r quest log / go outside / drop apple / take apple / w / insert apple into barrel / r quest log / r put apple in barrel"[/code][/spoiler]

this looks very interesting. will check it out more thoroughly. thanks for your work!

Thanks! I already see some changes I want to make, but I’m going to wait for some feedback before I implement them.

I have only glanced through the source code, not tested it. But first question that comes to mind: why do you have a “reporting” action distinct from “consulting”?

A couple of reasons. Firstly, “Consulting” is an action on a text, while “Researching” is an action on an object, so I couldn’t do what I wanted to do by merely modifying the consulting action. Eric Eve essentially does the same thing for the exact same reasons in his conversation framework.

Secondly, I wanted to retain easy functionality of the consulting action. Since the researching action accesses information in the same way no matter what your researching on, having dynamic exposition fit into consulting would be awkward, and you couldn’t implement, for example, a file cabinet which is consultable, and an encyclopedia which is consultable, without running the risk of the player being able to consult things from the filing cabinet that should be in the encyclopedia and vice versa.

I suppose it’s possible to fit the functionality into one action if you had a table associated with each topic, but it would come to the point where having two separate actions would be far less confusing. As far as the player is concerned, however, they are essentially the same action, and use virtually the same synonyms, so it’s unlikely they’ll notice the difference.

After looking a the code for a bit, I think it would be better implemented as a system of tables, with each entry associated with an ID. Instead of having a list of texts, you’d have a list of ID numbers. This would also give a lot more control over the output, and have the added bonus of being more readily able to prevent duplication. It would require something of a rewrite, but it’s not exactly a large extension, so it wouldn’t be too much work.

This looks pretty interesting! I like the idea of having a volume of text that I can write to and remove from on the fly. I will try it out.

Thanks! I’ve finished a major rewrite that I really think improves the functionality considerably, so I would avoid using a large project with it yet, but I haven’t performed my internal tests on it yet so I’m not going to put it up just yet. I also need to rewrite the documentation.

Here is the rewritten code:

[spoiler][code]Chapter 1 - The Exposition List

All things have a list of numbers called an exposition-list.

All things has a table-name called the exposition-reference. The exposition-reference is usually the table of null exposition.

When play begins (this is the initial reference rule):
repeat with item running through all things:
if the exposition-reference of the item is table of null exposition:
next;
if there is an ID of 1 in the exposition-reference of the item:
add 1 to the exposition-list of the item.

To decide if the exposition-list of (item - a thing) is blank:
let N be the exposition-list of the item;
let X be the number of entries in N;
if X is 0:
decide yes;
else:
decide no.

Definition: A thing is researchable:
if the exposition-list of it is blank, decide no;
decide yes.

Chapter 2 - Printing the Exposition

The display records rules is a rulebook.

Printing the exposition of something is an activity.

Rule for printing the exposition of something (called the item) (this is the standard exposition printing rule):
say “You look up information on [the item]:[paragraph break]”;
print the exposition of the item.

To print the exposition of (the item - a thing), as one paragraph:
let the current exposition be the exposition-list of the item;
if as one paragraph:
repeat with X running through the current exposition:
choose the row with ID of X from exposition-reference of the item;
say the exposition entry;
else:
repeat with X running through the current exposition:
choose the row with ID of X from exposition-reference of the item;
say the exposition entry;
say paragraph break.

A display records rule:
carry out the printing the exposition activity with the noun.

Chapter 3 - Writing the Exposition

To decide whether (addition - a number) is already written for (current subject - a thing):
let current exposition be the exposition-list of the current subject;
repeat with individual entry running through the current exposition:
if individual entry is the addition:
decide yes;
decide no.

To write entry (addition - a number) for the topic (current subject - a thing), silently, at start:
unless the addition is already written for current subject:
let current exposition be the exposition-list of the current subject;
let N be the number of entries in the current exposition;
if at start:
add addition at entry 1 in the exposition-list of the current subject;
else:
add addition to the exposition-list of the current subject;
if silently:
do nothing;
else:
mark current subject for announcement.

Chapter 4 - Researching action

Researching it on is an action applying to one visible thing and one touchable thing.

A thing can be expository. A thing is usually not expository.

Does the player mean researching something on an expository thing: it is very likely.

Rule for deciding the scope of the player while researching (this is the can research all known researchable things rule):
repeat with X running through known things:
place X in scope.

Understand “read about [something] in [something]” as researching it on when the second noun is an expository thing. Understand “look up [something] in [something]” as researching it on when the second noun is an expository thing. Understand “consult [something] on/about [something]” as researching it on (with nouns reversed) when the second noun is an expository thing. Understand "read [something] in [something]"as researching it on when the second noun is an expository thing. Understand “research [something] on/about [something]” as researching it on (with nouns reversed). Understand “research [something] in [something]” as researching it on.

Understand “research on/about/-- [something]” as researching it on. Understand “read on/about/-- [something]” as researching it on. Understand “look up [something]” as researching it on. Understand “r [something]” as researching it on.

Check researching it on (this is the can’t research on an expository thing rule):
if the second noun is not an expository thing:
say “You can’t use [the second noun] like that.” instead.

Check researching it on (this is the can’t research unresearchable objects rule):
if the noun is not researchable:
say “There is no entry about that.” instead.

Report researching it on (this is the standard research rule):
follow the display records rulebook.

The default-expository is a thing that varies.

Rule for supplying a missing second noun while researching (this is the use default expository rule):
let N be the default-expository;
now the second noun is N.

Chapter 5 - Reporting Additions to the Expository

The announcement queue is a list of objects that varies.

To mark (item - a thing) for announcement:
if the item is not listed in the announcement queue:
add item to the announcement queue.

Carry out looking (this is the mark items to expository announce when looking rule):
unless in darkness:
repeat with item running through things that are enclosed by the location:
if the item is not enclosed by an opaque closed container:
if the item is unseen and the item is researchable:
mark item for announcement.

The mark items to expository announce when looking rule is listed before the mark items as seen when looking rule in the carry out looking rules.

Carry out opening a container (this is the mark items to expository announce on opening a container rule):
repeat with item running through things that are enclosed by the noun:
if the item is unseen and the item is visible:
if the item is researchable:
mark item for announcement.

The mark items to expository announce on opening a container rule is listed before the mark items as seen on opening a container rule in the carry out opening rules.

Toggle expoannouncements is a truth state that varies. Toggle expoannouncements is usually true.

Printing the expository announcement of something is an activity.

Rule for printing the expository announcement of something (called the subject announced) (this is the standard expository announcement printing rule):
say “[italic type]New information on '”;
carry out the printing the name activity with subject announced;
say “’ has been added to the records.[roman type]”

This is the notify expository changes rule:
if the toggle expoannouncements is true:
repeat with current subject running through announcement queue:
carry out the printing the expository announcement activity with the current subject;
repeat with current subject running through announcement queue:
remove current subject from announcement queue.

The notify expository changes rule is listed after the note object acquisitions rule in the turn sequence rules.

When play begins (this is the suppress announcements by marking as seen rule):
now every visible thing is seen.

Table of Null Exposition
ID Exposition
a number a text

Dynamic Exposition ends here.[/code][/spoiler]

And here is the test game:

[spoiler][code]Include Epistemology by Eric Eve.
Include Dynamic Exposition by William S Martin.

The rocky hills are a room. South of the rocky hills is the martian base. North of the rocky hills is the martian desert. North of the martian desert are the craggy cliffs. North of the craggy cliffs are the ice caps.

The player is in the martian base. The player is carrying a scanotron.

The player is carrying an info-display. The info-display is an expository thing.

The default-expository is the info-display.

The toggle expoannouncements is true.

The hab-tech is a thing. It is in the martian base. It is fixed in place. The exposition-reference is the Table of Hab-tech Research.

Table of Hab-tech Research
ID Exposition
1 “You live in a hab-tech. They are quite plain on the inside.”
2 “Your scanotron tells you that the hab-tech is mostly made of titanium.”

Some fascinating rocks are a thing. It is in the rocky hills. The exposition-reference is the Table of Fascinating Rocks Research.

Table of Fascinating Rocks Research
ID Exposition
1 “The rocks have fascinating flecks of color in them. You must investigate them.”
2 “Scans indicate high levels of crystal formations that are causing the flecks of color.”

The petrified plant is a thing. It is in the martian desert. The exposition-reference is the Table of Petrified Plant Research.

Table of Petrified Plant Research
ID Exposition
1 “Embedded in a rock you can see what you believe to be are ancient fronds.”
2 “Scans indicate amino acids in the rock. Your hunch about them being fossils is correct.”

The massive crystal is a thing. It is fixed in place. It is in the craggy cliffs. The exposition-reference is the Table of Massive Crystal Research.

Table of Massive Crystal Research
ID Exposition
1 “You discovered this fascinating blue crystal in the rocky hills.”
2 “You detected carbon within the crystals.”

The alien artifact is a thing. It is fixed in place. It is in the ice caps. The exposition-reference is the Table of Alien Artifact Research.

Table of Alien Artifact Research
ID Exposition
1 “The ancient (presumably Martian) baton-looking object is just a featureless metal tube.”
2 “When you scanned the object, it produced what looks like an alien script. Fascinating.”

Rule for printing the exposition of something when the second noun is an info-display:
say “[italic type]You search for ‘[the noun]’ in the info-display. It prints:[roman type][paragraph break]”;
print the exposition of the noun;
say “END TRANSMISSION”.

Rule for printing the exposition of the alien artifact when the second noun is an info-display:
say “Your info-display is nearly smoking as you access information on the alien artifact… [paragraph break]”;
print the exposition of the alien artifact;
say “END TRANSMISSION”.

Rule for printing the expository announcement of something (called the item) when the player carries an info-display:
say “[italic type]Your info-display beeps with new information on [the item][roman type].”

Rule for printing the expository announcement of something (called the item) while scanning and the player carries an info-display:
say “[italic type]New information on [the item] has been uploaded from the scanotron[roman type].”

Rule for printing the expository announcement of the alien artifact while the player carries an info-display:
say “BZZT! Your info-display suddenly goes haywire! It calms after a moment.”

Section - Scanning

Scanning is an action applying to one visible thing.

Understand “scan [something]” as scanning.

Check scanning:
if the actor is not carrying a scanotron:
say “You can’t scan without a scanotron.” instead.

Check scanning:
if 2 is already written for the noun:
say “Your scanner detects nothing new.” instead.

Check scanning:
if the noun is not researchable:
say “That object isn’t interesting to scan.” instead.

Carry out scanning:
write entry 2 for the topic noun.

A thing has a text called scanned information.
A thing can be scanned or unscanned. A thing is usually not scanned.

Test me with “r hab-tech / scan hab-tech / r hab-tech / n / n / n / n / r artifact / scan artifact / r artifact”[/code][/spoiler]

Externally, to the player, the rewritten code will function exactly the same as the original above. Internally, it is quite different, I think for the better. Instead of the exposition-list storing a list of texts to display, the exposition-list contains a list of numbers that refer to an ID section on a table, and prints the corresponding text. There are number of pros/cons, but I think the the pros outweigh the cons.

PROS
-Keeps all the exposition text in a central location, instead of distributed around the code, a big plus for large projects.
-Tables keep stuff nice and neat.
-You can designate certain ID numbers for special purposes, reducing the amount of text properties you need. For example, in the sample game, ID 2 text designates information learned after scanning something. In the sample game in the original code, it required a text property called “scanned information”.
-Allows for much easier comparison between different exposition-lists.
-Allows for the capacity to sort the exposition-list.
-Beginner users no long have to deal directly with the exposition-list.

CONS
-Tables can be pretty annoying to lay out.
-You need a new table for every object you want to have an exposition, which could get fairly annoying.

I imagine that the larger the project gets the more impact these changes will make, and since this extension is written for larger projects in mind, I’m going to prioritize them.
In addition to the above, there are also some other important changes:

-All rules are now named.
-The “write entry x for topic y” phrase now checks if it’s about to add a duplicate entry, and cancels if it does, allowing authors to be more flexible with that particular phrase.
-To avoid the delayed exposition announcement bug, visible things are marked as “seen” in the starting room before the game begins.
-When play begins, the game processes through every researchable thing in the game and adds ID 1 to the exposition-list, if it has that entry in its reference table.

I’m going to see if there is anything else that I find striking before submitting to the I7 website.

PS I might add some say phrases to manipulate exposition within text.

This may very well be the final version of the extension before I send it off to the I7 website. I’m going to let it percolate for a bit in case anything is dramatically wrong.

[spoiler][code]Dynamic Exposition by William S Martin begins here.

“Gives players access to a database that updates dynamically during play and announces modifications to the player. This allows easy implementations of journals, quest logs, the internet, and so forth.”

Include Epistemology by Eric Eve.

Chapter 1 - The Exposition List

All things have a list of numbers called an exposition-list.

All things has a table-name called the exposition-reference. The exposition-reference is usually the table of null exposition.

When play begins (this is the initial reference rule):
repeat with item running through all things:
if the exposition-reference of the item is table of null exposition:
next;
if there is an ID of 1 in the exposition-reference of the item:
add 1 to the exposition-list of the item.

To decide if the exposition-list of (item - a thing) is blank:
let N be the exposition-list of the item;
let X be the number of entries in N;
if X is 0:
decide yes;
else:
decide no.

Definition: A thing is researchable:
if the exposition-list of it is blank, decide no;
decide yes.

Chapter 2 - Printing the Exposition

Printing the exposition of something is an activity.

Rule for printing the exposition of something (called the item) (this is the standard exposition printing rule):
say “You look up information on [the item]:[paragraph break]”;
print the exposition of the item.

To print the exposition of (the item - a thing), as one paragraph:
let the current exposition be the exposition-list of the item;
if as one paragraph:
repeat with X running through the current exposition:
choose the row with ID of X from exposition-reference of the item;
say the exposition entry;
else:
repeat with X running through the current exposition:
choose the row with ID of X from exposition-reference of the item;
say the exposition entry;
say paragraph break.

Chapter 3 - Writing the Exposition

To decide whether (addition - a number) is already written for (current subject - a thing):
let current exposition be the exposition-list of the current subject;
repeat with individual entry running through the current exposition:
if individual entry is the addition:
decide yes;
decide no.

To write entry (addition - a number) for the/-- topic (current subject - a thing), silently, at start:
unless the addition is already written for current subject:
let current exposition be the exposition-list of the current subject;
let N be the number of entries in the current exposition;
if at start:
add addition at entry 1 in the exposition-list of the current subject;
else:
add addition to the exposition-list of the current subject;
if silently:
do nothing;
else:
mark current subject for announcement.

To say write entry (addition - a number) for the/-- topic (current subject - a thing):
unless the addition is already written for current subject:
let current exposition be the exposition-list of the current subject;
let N be the number of entries in the current exposition;
add addition to the exposition-list of the current subject;
mark current subject for announcement.

Chapter 4 - Researching action

Researching it on is an action applying to one visible thing and one touchable thing.

A thing can be expository. A thing is usually not expository.

Does the player mean researching something on an expository thing: it is very likely.

Rule for deciding the scope of the player while researching (this is the can research all known researchable things rule):
repeat with X running through known things:
place X in scope.

Understand “read about [something] in [something]” as researching it on when the second noun is an expository thing. Understand “look up [something] in [something]” as researching it on when the second noun is an expository thing. Understand “consult [something] on/about [something]” as researching it on (with nouns reversed) when the second noun is an expository thing. Understand "read [something] in [something]"as researching it on when the second noun is an expository thing. Understand “research [something] on/about [something]” as researching it on (with nouns reversed). Understand “research [something] in [something]” as researching it on.

Understand “research on/about/-- [something]” as researching it on. Understand “read on/about/-- [something]” as researching it on. Understand “look up [something]” as researching it on. Understand “r [something]” as researching it on.

Check researching it on (this is the can’t research on an expository thing rule):
if the second noun is not an expository thing:
say “You can’t use [the second noun] like that.” instead.

Check researching it on (this is the can’t research unresearchable objects rule):
if the noun is not researchable:
say “There is no entry about that.” instead.

Report researching it on (this is the standard research rule):
carry out the printing the exposition activity with the noun.

The default-expository is a thing that varies.

Rule for supplying a missing second noun while researching (this is the use default expository rule):
let N be the default-expository;
if N is in the location or the player is carrying N:
if the N is expository:
now the second noun is N;
else:
say “You need to specify an object to do research with.”;
else if there is an expository thing in the location:
let K be a random expository thing in the location;
now the second noun is K;
else:
say “You need to specify an object to do research with.”

Chapter 5 - Reporting Additions to the Expository

The announcement queue is a list of objects that varies.

To mark (item - a thing) for announcement:
if the item is not listed in the announcement queue:
add item to the announcement queue.

Carry out looking (this is the mark items to expository announce when looking rule):
unless in darkness:
repeat with item running through things that are enclosed by the location:
if the item is not enclosed by an opaque closed container:
if the item is unseen and the item is researchable:
mark item for announcement.

The mark items to expository announce when looking rule is listed before the mark items as seen when looking rule in the carry out looking rules.

Carry out opening a container (this is the mark items to expository announce on opening a container rule):
repeat with item running through things that are enclosed by the noun:
if the item is unseen and the item is visible:
if the item is researchable:
mark item for announcement.

The mark items to expository announce on opening a container rule is listed before the mark items as seen on opening a container rule in the carry out opening rules.

Toggle expoannouncements is a truth state that varies. Toggle expoannouncements is usually true.

Printing the expository announcement of something is an activity.

Rule for printing the expository announcement of something (called the subject announced) (this is the standard expository announcement printing rule):
say “[italic type]New information on '”;
carry out the printing the name activity with subject announced;
say “’ has been added to the records.[roman type]”

This is the notify expository changes rule:
if the toggle expoannouncements is true:
repeat with current subject running through announcement queue:
carry out the printing the expository announcement activity with the current subject;
repeat with current subject running through announcement queue:
remove current subject from announcement queue.

The notify expository changes rule is listed after the note object acquisitions rule in the turn sequence rules.

When play begins (this is the suppress announcements by marking as seen rule):
now every visible thing is seen.

Table of Null Exposition
ID Exposition
a number a text

Dynamic Exposition ends here.

---- DOCUMENTATION ----

Dynamic Exposition adds a dynamic database system that can be used as the basis to implement a variety of things. For example:

A) Journals, notebooks and so forth that records the player character’s thoughts and observations during play.

B) The internet, magical enyclopedias, crystal balls, Akashic records or any other device with access to a highly dynamic source of information.

C) The player’s thoughts and memories that change over time.

D) A quest log, that keeps track of things that a character needs to do. The example, the Adventures of Glubby, provides a basic framework for a quest log.

Some of these can be implemented with almost no work. For others, some assembly is required.

Chapter: How it Works

Dynamic Exposition is designed to simulate things like the internet and journals. It works much like a consulting: the player “consults” or “researches” a book or crystal ball or whatever, and a text is then displayed to the player. The significant difference between regular consulting and Dynamic Exposition is that Dynamic Exposition allows for much more variation in the output, and also allows for announcements when there are modifications made to expositions.

By default, exposition requires a physical “expository” thing that the player “reads” off of. However, it would not be difficult to simulate thinking and memories with dynamic exposition. It may require a new “thinking about” action.

Chapter: Setting up Dynamic Expositions

Dynamic Expositions requires a bit of work to get full use out of it. For smaller games, it could be better just to use the consult command to get what we need.

First, we need an expository thing. The expository thing is needed by the player to access the database. Keep in mind all expository things have access to the same database, no matter what. So it would make sense for an iPad, a computer and a smart phone to all be expository things that access the internet, but it would make no sense at all for Jack’s diary and Bill’s notebook to both be expository things.

The audio recorder is here. It is expository.

Each thing you want to have an exposition has a table known as its exposition-reference, which contains every entry you want for that particular object. The table must include two different columns: an ID column, containing a number, and an exposition column, containing a text. At an absolute minimum, you need something like this:

The salmon is a thing. The exposition-reference is the Table of Salmon Research.

Table of Salmon Research
ID	Exposition
 1	"Salmon are a sort of fish that like to swim upriver."

The ID entry acts as a reference for the Exposition text. When the exposition is invoked, it reads off a list of numbers contained in the object called an “exposition-list”, then reads off the corresponding Exposition entry in its exposition-reference. In general, you should never need to directly deal with the exposition-list for this extension to work as intended.

ID 1 is special. Any exposition corresponding to ID 1 is displayed even if it is not explicitly written to the exposition-list, making it the “default exposition”. If you don’t want to initially have any text displayed for that particular object, then simply skip ID 1. There’s no reason you couldn’t use an entirely random set of numbers as IDs, so long as each ID is unique on that table.

The exposition-list by default is blank. The extension defines anything with a non-empty exposition-list as researchable, allowing us to make lists of researchable objects.

After researching the index on the magic encyclopedia:
	say "[list of known researchable things]".

This allows the player to write something like LOOK UP INDEX IN BOOK and get everything the book expounds upon.

Also, it is recommended that we make at least one expository thing the default-expository. When a player doesn’t provide a second noun by default it will pick the default-expository, or else a random expository in the same location as the player.

This allows the player to write things like RESEARCH CHUPACABRA or even R CHUPACABRA without needing to type in something like RESEARCH DIARY ABOUT CHUPACABRA every time.

Chapter: Accessing and Writing to the Exposition

The exposition-list is “read” by using the a new researching action.

Instead of consulting the necronomicon about death, try researching the necronomicon about death.

What might the output of the above be?

You look up information on death. It reads:

"Death is a beginning and not an end"

The first part, “You look up information on death. It reads:” does not have to be written out in the exposition-reference of the second noun. It is a text that is printed as a part of the “printing the exposition of” activity which introduces the text we are about to read. This can be customized, as we can see later.

The second part is the actual exposition entry of the second noun.

We may also make dynamic additions to any recordall text with the phrase “write entry (a number) for the topic (a thing)”

Let’s say that the player discovers some terrible secret about death:

After consulting the encyclopedia about death for the first time, write entry 2 for the topic death.

Which refers to entry 2 of the exposition-reference, “Legal death is when your heart stops.”

This adds a new paragraph to your exposition for death. Before writing, the phrase automatically checks to see if it is about to write a duplicate entry into the exposition, so you don’t need to worry about using that phrase liberally.

This phrase also has a number of options.

write entry 2 for the topic beer, silently.

The “silently” option suppresses the modification announcement cause by the use of the “write” phrase. More is written about this in Chapter 4 - Announcement of Entries.

write entry 2 for the topic beer, at start.

By default, the phrase puts the new addition at the end of the exposition-list. This instead tacks it in the beginning.

Finally, the extension adds a say phrase to write to exposition within the text. This phrase doesn’t allow any of the same options above.

After drinking the beer:
	say "Drink to your health![write entry 2 for the topic beer]"

Chapter: Using the Consult Action

While the consulting and researching action use the same commands, the extension attempts to understand by context when to use the researching action and the consulting action.

You can use the consulting action to simulate more static databases, like a mundane, papery encyclopedia, and still have the function of the expository.

The magic encyclopedia an expository thing.

The mundane encyclopedia is a thing.

So long as either one or the other is in scope, the game will generally understand which action to use with CONSULT THE ENCYCLOPEDIA ABOUT DRAGONS. If they are both in scope, you might want to clarify with some contextual understand commands.

Chapter: Customizing the Output

The way which expositions are displayed can be very heavily customized. The Mysteries of Mars example shows you how you can customize messages depending on what object is being expounded upon.

Rule for printing the exposition of a planet (called the current planet):
	say "Classification: [classification of current planet][paragraph break]Diameter: [diameter of the current planet][paragraph break]Gravity: [gravitation pull of current planet][pargraph break]Average Temperature: [temp of current planet][paragraph break]Current records of planet:[paragraph break]";
	print the exposition of the current planet;
	say "END TRANSMISSION".

Whenever a new rule is written for the exposition of something, it should include the phrase “print the exposition of…”

By default, each new entry is printed as a seperate paragraph. We can, however, choose to group it in just a single paragraph by using the “as one paragraph” option with the “print exposition of” phrase.

Rule for printing the exposition of a hastily scribbled thing (called the item):
	print the exposition of the item, as one paragraph.

Chapter: Announcements of Entries

Dynamic Exposition has the capacity to print an announcement every time something is written to it. By default, it is turned off, so if the feature doesn’t appeal to us, we don’t need to worry about this section at all.

If, however, we do want to play around with it, we can write in our code:

*:
The toggle expoannouncements is true.

This activates the announcement system. Every time a player sees a researchable thing for the first time, or a new entry is written to the announcement system, the game will print an announcement declaring new information is available on that subject.

If we only want certain items to be announced, we can make a new rule for items we don’t want announced and leave them blank.

Rule for printing the expository announcement of an unimportant thing:
	do nothing.

The second way we can suppress a expository announcement is to use the “silently” option on the “write (text) for the topic (thing).”

We can use the same rule to play around with announcements for different things:

Rule for printing the expository announcement of an unfortunate thing:
	say "As you're writing the entry in the journal, you prick your finger with the nib of your pen.";
	now the player is bleeding.

This will replace the standard expository announcement and replace it with this text, in addition to making the unfortunate player bleed.

Example: ** Mysteries of Mars - Implements a very simple dynamic journal system where scanning an object writes a text to the exposition of an object. Also, demonstrates how you can vary exposition outputs and announcements depending on the object.

*: “Mysteries of Mars”

The rocky hills are a room. South of the rocky hills is the martian base. North of the rocky hills is the martian desert. North of the martian desert are the craggy cliffs. North of the craggy cliffs are the ice caps.

The player is in the martian base. The player is carrying a scanotron.

The player is carrying an info-display. The info-display is an expository thing.

The default-expository is the info-display.

The toggle expoannouncements is true.

The hab-tech is a thing. It is in the martian base. It is fixed in place. The exposition-reference is the Table of Hab-tech Research.

Table of Hab-tech Research
ID	Exposition
1	"You live in a hab-tech. They are quite plain on the inside."
2	"Your scanotron tells you that the hab-tech is mostly made of titanium."

Some fascinating rocks are a thing. It is in the rocky hills. The exposition-reference is the Table of Fascinating Rocks Research.

Table of Fascinating Rocks Research
ID	Exposition
1	"The rocks have fascinating flecks of color in them. You must investigate them."
2	"Scans indicate high levels of crystal formations that are causing the flecks of color."

The petrified plant is a thing. It is in the martian desert. The exposition-reference is the Table of Petrified Plant Research.

Table of Petrified Plant Research
ID	Exposition
1	"Embedded in a rock you can see what you believe to be are ancient fronds."
2	"Scans indicate amino acids in the rock. Your hunch about them being fossils is correct."

The massive crystal is a thing. It is fixed in place. It is in the craggy cliffs. The exposition-reference is the Table of Massive Crystal Research.

Table of Massive Crystal Research
ID	Exposition
1	"You discovered this fascinating blue crystal in the rocky hills."
2	"You detected carbon within the crystals."

The alien artifact is a thing. It is fixed in place. It is in the ice caps. The exposition-reference is the Table of Alien Artifact Research.

Table of Alien Artifact Research
ID	Exposition
1	"The ancient (presumably Martian) baton-looking object is just a featureless metal tube."
2	"When you scanned the object, it produced what looks like an alien script. Fascinating."

Rule for printing the exposition of something when the second noun is an info-display:
	say "[italic type]You search for '[the noun]' in the info-display. It prints:[roman type][paragraph break]";
	print the exposition of the noun;
	say "END TRANSMISSION".

Rule for printing the exposition of the alien artifact when the second noun is an info-display:
	say "Your info-display is nearly smoking as you access information on the alien artifact.... [paragraph break]";
	print the exposition of the alien artifact;
	say "END TRANSMISSION".

Rule for printing the expository announcement of something (called the item) when the player carries an info-display:
	say "[italic type]Your info-display beeps with new information on [the item][roman type]."

Rule for printing the expository announcement of something (called the item) while scanning and the player carries an info-display:
	say "[italic type]New information on [the item] has been uploaded from the scanotron[roman type]."

Rule for printing the expository announcement of the alien artifact while the player carries an info-display:
	say "BZZT! Your info-display suddenly goes haywire! It calms after a moment."

Section: Scanning

Scanning is an action applying to one visible thing.

Understand "scan [something]" as scanning.

Check scanning:
	if the actor is not carrying a scanotron:
		say "You can't scan without a scanotron." instead.

Check scanning:
	if 2 is already written for the noun:
		say "Your scanner detects nothing new." instead.

Check scanning:
	if the noun is not researchable:
		say "That object isn't interesting to scan." instead.

Carry out scanning:
	write entry 2 for the topic noun.

Test me with "r hab-tech / scan hab-tech / r hab-tech / n / n / n / n / r artifact / scan artifact / r artifact"

Example: *** The Adventures of Glubby - Uses the dynamic journal system as the basis for a simple quest log, like what is found in other games. This takes record of tasks that need to be done. The extension also demonstrates how you can use phrases to make use of blank entries, never needing to directly fill in the exposition-reference tables.

*: “The Adventures of Glubby”

Section: Rules

The toggle expoannouncements is true.

A quest is a kind of subject. A quest can be inactive, newly started, started or finished. A quest is usually inactive.

To update (current quest - a quest) with (addition - a text):
	if the current quest is not started:
		do nothing;
	else:
		repeat through the exposition-reference of the current quest:
			if the ID entry is 1 or the ID entry is 2 or the ID entry is 3:
				next;
			if there is no exposition entry:
				now the exposition entry is the addition;
				write entry ID entry for the topic current quest;
				break.
		
	

To complete (current quest - a quest) with (addition - a text):
	if the current quest is not started:
		do nothing;
	else:
		now the exposition corresponding to an ID of 3 in the exposition-reference of the current quest is the addition;
		write entry 3 for the topic current quest;
		now the current quest is finished.

To start (current quest - a quest) with (addition - a text):
	if the current quest is not inactive:
		do nothing;
	else:
		now exposition corresponding to an ID of 2 in the exposition-reference of the current quest is the addition;
		write entry 2 for the topic current quest;
		now the current quest is newly started.

Rule for printing the exposition of a quest (called the current quest):
	say "DUM-dee-dee-DUM! The epic [current quest] is [if current quest is started]underway[else]completed[end if]! Here is a list of your mighty achievements thus far...[paragraph break]";
	print the exposition of current quest.

Rule for printing the expository announcement of a newly started quest (called the current quest):
	say "DUM-dee-dee-DUM! You have a new quest... [the current quest]!";
	now the current quest is started.

Rule for printing the expository announcement of a started quest (called the current quest):
	say "DERP-dee-dee-DOO! You have exquisitely advanced [the current quest]!"

Rule for printing the expository announcement of a finished quest (called the current quest):
	say "DERP-dee-dum-DOO-dee-dum-DEE! You have completed [the current quest]!"

The quest log is a subject.

Instead of researching the quest log on something:
	say "Current quests: [list of started quests]";
	say "[paragraph break]";
	say "Completed quests: [list of finished quests]".

Section: The Scenario

The forest is a room. East of the forest is the mill. Inside of the mill is the mill interior.

The quest journal is a thing. It is expository. The player is carrying the quest journal.

The default-expository is the quest journal.

The apple is a thing.

The barrel is a container. It is open. It is in the forest.

The player is in the forest.

After going to the mill for the first time:
	Update Visit the Mill with "You have strode through the forest toward the mill. All that is left is to go inside the mill."

After going to the mill interior for the first time:
	complete visit the mill with "Bravely, you have entered the mill, and even assigned to a new, even more glorious task!";
	say "You enter the mill, screaming with triumph. Suddenly the miller appears out of nowhere, saying breathlessly, 'Good sir! I need an apple placed in a barrel in the forest! This is an important task... do you think you can do it for me?'[paragraph break]Before you have a chance to respond, he tosses you a glossy, red apple, and then leaves immediately.[paragraph break]You're about to undertake the task, you hear his voice: 'Whatever you do, don't drop the apple!'";
	start put-apple-in-barrel with "The miller has given you the mighty task to put an apple inside a barrel. He specifically asked you not to drop the apple.";
	now apple is in the player.

When play begins:
	say "You have a valiant quest... to visit the mill east of the river!"

There is a quest called Visit the Mill. The printed name is "the quest to visit the mill". The exposition-reference is the Table of Mill Quest. It is started.

Understand "quest to visit the mill" as visit the mill.

There is a quest called Put-Apple-in-Barrel. The printed name is "the quest to put the apple in the barrel". The exposition-reference is Table of Barrel Quest

Understand "put apple in barrel" as put-apple-in-barrel.

After going to the mill while the player is carrying an apple for the first time:
update put-apple-in-barrel with "You have strode with alacrity across with the apple."

After going to the forest while the player is carrying an apple for the first time:
update put-apple-in-barrel with "Amazing! You are almost there! Now just put the apple in the barrel."

After inserting the apple into the barrel for the first time:
complete put-apple-in-barrel with "You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! You put the apple in the barrel! The miller will be so happy!"

After dropping the apple for the first time:
say "Nooooo! you dropped the apple!";
complete put-apple-in-barrel with "You insolent worm! You dropped the apple! Now the miller will be in despair!"

Table of Mill Quest
ID	Exposition
1	"You have bequeathed upon thyself the task of putting the apple in the barrel."
2	--
3	--
4	--
5	--
6	--
7	--
8	--


Table of Barrel Quest
ID	Exposition
2	--
3	--
4	--
5	--
6	--
7	--
8	--

test me with "r quest log / e / r visit the mill / go inside / r visit the mill / r quest log / go outside / drop apple / take apple / w / insert apple into barrel / r quest log / r put apple in barrel"

[/code][/spoiler]