When in Rome 1: Accounting for Taste — 17 of 31

Emily Short

Release 4

Section 2 - A set of rules for having the girl act intelligently

[The purpose of this section is to equip the girl to pick things up intelligently before she needs to use them, open and close containers, and so on. It also has a mechanism for stringing together several non-player-character actions into single sentences. This is a fairly low-tech approach and there would be more sophisticated ways to do the same thing, but this will work for the time being.]

Before the girl trying inserting something into a closed openable container (called the receptacle):

increment depth;

try the person asked trying opening the receptacle.

Before the girl trying going through a closed door (called impediment):

increment depth;

try the person asked trying opening the impediment.

Before the girl trying entering a closed thing (called the receptacle):

increment depth;

try the person asked trying opening the receptacle.

Before the girl trying exiting when the person asked is in a closed thing (called the receptacle):

increment depth;

try the person asked trying opening the receptacle.

Before the girl trying searching a closed container (called the receptacle):

increment depth;

try the person asked trying opening the receptacle.

Before the girl trying wearing something which is not carried by the person asked:

increment depth;

try the person asked trying taking the noun.

Before the girl trying eating something which is not carried by the person asked:

increment depth;

try the person asked trying taking the noun.

Before the girl trying giving something to someone when the noun is not carried by the person asked:

increment depth;

try the person asked trying taking the noun.

Before the girl trying throwing something at something when the noun is not carried by the person asked:

increment depth;

try the person asked trying taking the noun.

A rule for reaching inside a closed openable container (called target):

if the person reaching is not the person asked, make no decision;

if the person reaching is not the player

begin;

increment depth;

try the person reaching trying opening the target;

end if.

To increment depth:

increase the action stack depth by 1;

increase the maximum action stack depth by 1.

The action stack depth is a number that varies. The action stack depth is 0. [This is how deeply we've currently committed the character to go. In this extension, this won't be deeper than 2.]

The maximum action stack depth is a number that varies. The maximum action stack depth is 0. [This is the total number of actions we've stacked this turn, regardless of which one we're currently on.]

First every turn rule:

if Getting handbag is happening

begin;

now the action stack depth is 0; now the maximum action stack depth is 0; now every person is ignored; remove properties;

end if.

Report the girl trying opening something when the action stack depth is greater than 0:

say "[The person asked]";

decrease the action stack depth by 1;

say " opens [the noun][continue]";

stop the action.

Report the girl trying taking something when the action stack depth is greater than 0:

say "[The person asked]";

decrease the action stack depth by 1;

say " picks up [the noun][continue]";

stop the action.

Report the girl trying exiting when the maximum action stack depth is greater than 0:

say "[The person asked] gets out." instead.

Report the girl trying entering something when the maximum action stack depth is greater than 0:

say "[The person asked] gets in." instead.

Report the girl trying wearing something when the maximum action stack depth is greater than 0:

say "[The person asked] puts it on." instead.

Carry out the girl trying throwing something at something:

move the noun to the location of the person asked.

The block throwing at rule does nothing if the person asked is not the player.

The futile to throw things at inanimate objects rule does nothing if the person asked is not the player.

Report the girl trying throwing something at something:

if the maximum action stack depth is greater than 0, say "[The person asked] throws it at [the second noun]. She misses by a mile." instead;

otherwise say "[The girl] flings [the noun] at [the second noun], but misses profoundly." instead.

Report the girl trying throwing something at something for the first time:

if the maximum action stack depth is greater than 0, say "[The person asked] throws it at [the second noun], but doesn't even come close to hitting. ";

otherwise say "[The girl] flings [the noun] at [the second noun], but misses profoundly. ";

say "'Sorry,' she says. 'Baseball isn't my game.'" instead.

Report the girl trying eating something when the maximum action stack depth is greater than 0:

say "[The person asked] eats it." instead.

Report the girl trying inserting something into something when the maximum action stack depth is greater than 0:

say "[The person asked] puts [the noun] inside." instead.

After printing the name of the girl:

if the girl is the person asked

begin;

now the girl is proper-named;

now the girl is previously implicated;

end if.

To say continue:

if the action stack depth is greater than 0, say ",[run paragraph on]";

otherwise say "[if maximum action stack depth is greater than 1][optional comma][end if] and[run paragraph on]";

A thing can be previously implicated or ignored.

Rule for printing the name of a previously implicated person when the action stack depth is not the maximum action stack depth:

do nothing.

Unsuccessful attempt by someone trying doing something when maximum action stack depth is greater than action stack depth: do nothing.

To say optional comma:

if the serial comma option is active:

say ",";

otherwise:

do nothing.

[Here it becomes useful to change Inform's idea of whether the girl has a proper name, in order to suppress articles under some circumstances.]

A person can be formerly-improper.

To make (target human - a person) proper:

now the target human is proper-named;

now the target human is formerly-improper.

To remove properties:

now every formerly-improper person is proper-named.

When Drinks ends:

remove properties.