Section 2 - Generating the Player's Command Line
The direct command is indexed text that varies.
[The idea here is that we want to be consistent in having the game present both player and NPC dialogue -- even when that dialogue is a command that might be interpreted as direct speech. Moderating for mood, we can use this as an opportunity to sketch in the characterization a little more, too.]
Rule for printing the name of the player while setting up the player's command:
say "me".
[Rule for printing the name of the current interlocutor while setting up the player's command:
say "yourself".
Rule for printing the name of Snow White's heart while setting up the player's command:
if the current interlocutor is the hart:
say "her heart";
otherwise:
say "your heart".
Rule for printing the name of Snow White while setting up the player's command:
if the current interlocutor is the hart:
say "[italic type]her[roman type]";
otherwise:
say "yourself". ]
Setting up the player's command is an activity.
For setting up the player's command:
change the direct command to "[recap of command]"; [1]
let N be word number 1 in direct command;
if N is "d" or N is "down":
change direct command to "dig a hole and descend into the earth";
if N is "e" or N is "east":
change direct command to "turn east";
if N is "go" or N is "leave" or N is "run" or N is "walk":
replace the regular expression " d$" in direct command with " down";
replace the regular expression " e$" in direct command with " east";
replace the regular expression " n$" in direct command with " North";
replace the regular expression " ne$" in direct command with " Northeast";
replace the regular expression " nw$" in direct command with " Northeast";
replace the regular expression " s$" in direct command with " south";
replace the regular expression " se$" in direct command with " southeast";
replace the regular expression " sw$" in direct command with " southwest";
replace the regular expression " u$" in direct command with " up";
if N is "take":
replace the regular expression "^take inventory" in direct command with "look through your things";
if N is "n" or N is "north":
change direct command to "continue north";
if N is "ne" or N is "northeast":
change direct command to "angle Northeast";
if N is "nw" or N is "northwest":
change direct command to "angle Northwest";
if N is "s" or N is "south":
change direct command to "turn back south";
if N is "se" or N is "southeast":
change direct command to "turn southeast";
if N is "sw" or N is "southwest":
change direct command to "turn southwest";
if N is "u" or N is "up":
change direct command to "climb something";
if N is "w" or N is "west":
change direct command to "turn west";
if the current interlocutor is the corpse:
replace the regular expression "your" in direct command with "my";
replace the text "Snow White's" in direct command with "her";
replace the text "snow white" in direct command with "her";
replace the regular expression "the corpse's" in direct command with "your";
otherwise:
replace the regular expression "your" in direct command with "my";
replace the text "Snow White's" in direct command with "your";
replace the regular expression "the corpse's" in direct command with "its";
replace the regular expression "myself's" in direct command with "your";
[if the noun is enclosed by the current interlocutor:
let Y be "[the noun]";
replace the text Y in the direct command with "your [noun]";
if the second noun is enclosed by the current interlocutor:
let Y be "[the second noun]";
replace the text Y in the direct command with "your [second noun]".]
A first persuasion rule (this is the producing instruction rule):
carry out the setting up the player's command activity;
if asking someone to try swearing mildly or asking someone to try swearing obscenely:
say "'[direct command in sentence case]!'";
make no decision;
if the current quip is restrictive:
refuse to change the subject for the current interlocutor;
persuasion fails;
issue command to the current interlocutor;
if the current quip is restrictive:
refuse to change the subject for the current interlocutor;
persuasion fails;
make no decision.
To issue a/-- command to (target - Snow White): [2]
if scariness is greater than 1 and a random chance of 1 in 3 succeeds:
change direct command to "[one of]I'd like you to[or]please[or]do me a favor and[as decreasingly likely outcomes] [direct command]";
if anger is greater than 1 and a random chance of 1 in 3 succeeds:
change direct command to "[direct command], if [one of]you would[or]you don't mind[or]you'd be so kind[at random]";
say "'[direct command in sentence case],' you [when warm]suggest[or weird]say[or menacing]suggest[or aggressive]beg[or furious]plead[or harmless]order[or needy]instruct her[or whiny]command, in your best hound-training voice[end when].";
To issue a/-- command to (target - new-snow-White):
change direct command to "[one of]why don't you[or]would you[or]how about if you[or]do you think you could[as decreasingly likely outcomes] [direct command]";
say "'[direct command in sentence case]?' you ask[one of][or] gently[or] in your most soothing tone[as decreasingly likely outcomes].";
To issue a/-- command to (target - corpse):
change direct command to "[one of]how about if you[or]would you[or]do you think you could[or]er, could you[as decreasingly likely outcomes] [direct command]";
say "'[direct command in sentence case]?' you ask.";
To issue a/-- command to (target - Snow White): [3]
if scariness is greater than 1 and a random chance of 1 in 3 succeeds:
change direct command to "[one of]I'd like you to[or]please[or]do me a favor and[as decreasingly likely outcomes] [direct command]";
if anger is greater than 1 and a random chance of 1 in 3 succeeds:
change direct command to "[direct command], if [one of]you would[or]you don't mind[or]you'd be so kind[at random]";
say "'[direct command in sentence case],' you [when warm]suggest[or weird]say[or menacing]suggest[or aggressive]beg[or furious]plead[or harmless]order[or needy]instruct her[or whiny]command, in your best hound-training voice[end when].";
To refuse to change the subject for (target - new-snow-white):
if asking someone to try swearing mildly or asking someone to try swearing obscenely:
say "'Um.'";
otherwise:
say "[line break]'Don't change the topic.'".
To refuse to change the subject for (target - Snow White):
now Snow White is already-talking; [This will prevent her also printing a nag line in this turn, because some of those juxtapositions sound redundant.]
if asking someone to try swearing mildly or asking someone to try swearing obscenely:
say "[line break][one of]She just stares coolly back at you. 'The question stands,' she says.[or]'I'm shocked,' she says, without being so at all. 'Now can we get back to the question?'[at random]";
otherwise:
say "[line break][one of]She just stares coolly back at you. 'The question stands,' she says.[or]'Don't try to change the subject.'[or]'One thing at a time,' she says.[at random]".
To refuse to change the subject for (target - corpse):
say "[line break][one of][The current interlocutor] just snorts rudely.[or]'One thing at a time!' says [the current interlocutor].[at random]".
Notes
[1]. This lets us tap into the same tricks the parser uses to recap the player's command
[2]. I'm using phrases rather than activities for this one because there is lower overhead, and I don't anticipate needing to do a lot of special-case overrides or before/after hooks on this particular thing.
[3]. I'm using phrases rather than activities for this one because there is lower overhead, and I don't anticipate needing to do a lot of special-case overrides or before/after hooks on this particular thing.