Faithful Companion — 4 of 17

Matt Weiner

Release 2

Section - Ghost Action Messages

Unsuccessful attempt message already printed is a truth state that varies. [For when another rule preempts the message we would print.]

Last every turn:

Now unsuccessful attempt message already printed is false.

First unsuccessful attempt by the ghost doing something when the ghost is not visible or unsuccessful attempt message already printed is true:

if the noun is a door and (the action name part of the current action is the opening action or the action name part of the current action is the turning action), continue the action.

[We need to print a message that describes what the ghost is doing when it tries to implicitly open a door, even when the player can't see the ghost, if the door is visible]

Check the ghost going (this is the ghost can't go through closed doors rule):

if the door gone through is not nothing and the door gone through is closed:

issue library message going action number 28 for the door gone through;

silently try the actor opening the door gone through;

if the door gone through is open, continue the action; [otherwise the ghost has failed to open the door; check to see if we can see it and/or the door, and issue an appropriate message]

if the ghost is visible:

say "[ghost visibly failing to open the door gone through] Then the leaves batter faintly against [the door gone through].";

now unsuccessful attempt message already printed is true; [the unsuccessful attempt could either be going or exiting, and either way we want to preempt it]

otherwise if the door gone through is visible:

say "[ghost invisibly failing to open the door gone through]";

stop the action. [if neither the ghost nor the door gone through is visible, we can stop the action without saying anything]

Unsuccessful attempt by the ghost opening a door:

if the reason the action failed is the can't open what's already open rule:

if the ghost is visible:

say "[ghost opening open noun]";

otherwise if the ghost is visible and the noun is visible:

say "[ghost visibly failing to open the noun]";

otherwise if the noun is visible:

unless the noun is out of reach of the ghost:

say "[ghost invisibly failing to open the noun]".

To say ghost visibly failing to open (portal - a door):

say "The leaves swirl against the handle of [the portal], but the door does not budge."

To say ghost invisibly failing to open (portal - a door):

say "A faint scratching comes from the other side of [the portal]. The handle of [the portal] turns, but the door does not open."

To say ghost opening open (portal - a door):

say "The leaves swirl through the motions of opening [the noun]."

[and we restore the normal rule for the player]

Check going (this is the player can't go through closed doors rule):

if the door gone through is not nothing and the door gone through is closed:

issue library message going action number 28 for the door gone through;

silently try opening the door gone through;

if the door gone through is open, continue the action;

stop the action.

[and unlist the old rule; fortunately there are no actors other than the ghost and the player]

The can't go through closed doors rule is not listed in any rulebook.

[Some miscellaneous ones]

Unsuccessful attempt by the ghost exiting in the Cemetery: say "[ghost tries to leave]". [The ghost might be trying to echo a previous action where the player typed "exit" or "out" to go out from another room.]

Unsuccessful attempt by the ghost going outside in the Cemetery: say "[ghost tries to leave]".

To say ghost tries to leave: say "The leaves swirl out toward the rest of the cemetery as if the ghost is trying to go farther from the tomb. But the ghost goes no further."

Unsuccessful attempt by the ghost dropping when the reason the action failed is the can't drop what's not held rule: say "The leaves swirl through the motions of putting something down."

After the ghost dropping something when the ghost is visible: say "The leaves swirl as though the ghost is putting something down, and [the noun] falls to [if the holder of the noun is not the location][the holder of the noun][otherwise if in the Cemetery]ground[otherwise]floor[end if]."

Check the ghost examining something when the ghost cannot see the noun: rule fails.

Rule for implicitly taking something (called target) when the ghost is the person asked and the ghost is not visible: silently try the ghost taking the target. [We want the ghost to try taking the target--as when we type "unlock door with key/drop key/in," in a couple turns the ghost should succeed in implicitly taking the key -- but we don't want to hear about it, with a clarification message or a success message.]

Rule for implicitly taking something (called target) when the ghost is the person asked and the ghost is visible:

if the player holds the target and the ghost can touch the player:

have the ghost frighten the player about the target; [see under "Ghost Frightening Touch"]

rule fails;

otherwise if the player is the target and the ghost can touch the player:

have the ghost frighten the player;

rule fails;

try the ghost taking the target;

if the ghost does not carry the target:

if the target is not visible:

say "The leaves swirl through the motions of picking something up.";

otherwise:

say "The leaves swirl through the motions of picking up [the target]."

Unsuccessful attempt by the ghost doing something:

say "The leaves swirl through the motions of [subjectless form of the current action].".

Imaginary object is a thing. It is proper-named. The printed name of the imaginary object is "something". [to handle messages when the ghost tries doing something to something we can't see]

Printing the subjectless form is a truth state that varies.

To say subjectless form of (X - a stored action): [This prints the action name without "the ghost" as the subject]

now printing the subjectless form is true;

now the ghost is proper-named;

let T be a stored action;

now T is X;

now the actor part of T is yourself;

now the request part of T is false;

if the noun part of T is not nothing and the noun part of T is not a direction and the noun part of T is not visible, now the noun part of T is the imaginary object;

if the second noun part of T is not nothing and the second noun part of T is not a direction and the second noun part of T is not visible, now the second noun part of T is the imaginary object;

if the action name part of T is the pushing it to action and (second noun part of T is inside or the second noun part of T is outside or the second noun part of T is down or the second noun part of T is up):

say "pushing [the noun part of T] [second noun part of T]";

[getting messages like "pushing the door to inside" got annoying enough that I decided to special-case it]

otherwise:

say T;

now printing the subjectless form is false;

now the ghost is improper-named.

Rule for printing the name of the player when printing the subjectless form is true: say "you". [Because the ghost will be the subject of the sentence. This gives a bad result when the player types "ask ghost for me" but why would you do that?]

Rule for printing the name of the ghost when printing the subjectless form is true: say "themselves". [The subject of the sentence should always be "the leaves."]

After the ghost examining something when the ghost is visible: say "The leaves swirl toward [the noun] as if the form within them is peering at [it-them]."

After the ghost taking something when the ghost is visible: say "The leaves swirl around [the noun] and [it-they] rises into the air among them, where the ghostly figure's hands might be."

After the ghost opening a door when the player can see the noun and the player cannot see the ghost: say "[The noun] opens."

Answering someone that is talking. Asking someone about is talking. Telling someone about is talking. Asking someone for is talking. Saying yes is talking. Saying no is talking. Saying sorry is talking.

After the ghost talking: say "The leaves swirl around as if the ghost is trying to talk."

Unsuccessful attempt by the ghost talking: say "The leaves swirl around as if the ghost is trying to talk."

[Both of these are necessary because the block asking rule is a report rule, so it won't trigger the unsuccessful attempt rulebook.]