Chapter - Beats and Threads
A beat is a kind of thing. A beat has some text called keyword name. [ The basic unit of conversation. ]
highlight topics is a truth state that varies. nicename topics is a truth state that varies.
Rule for printing the name of a beat (called topc) while highlight topics is true:
[ If Progue is asking a question, we don't want to highlight relevant words since that veers the conversation off topic. Instead, we add it to the list of subjects so the player can return to that idea later. (Note that non-yes/no answers need to be explicitly summoned.]
if topc is legit and last beat is insistent and topc is not summoned by last beat begin;
say "[keyword name of topc]";
if location is not regionally in Dreamlands and topc is not listed in list of convo stuff, add topc at entry 1 in list of convo stuff;
[ if this is a topic that we haven't discussed before (or we have and its repeatable and replaced by something), emphasize the word and summon it. ]
otherwise if topc is legit;
say "[t][keyword name of topc][x]";
now tempfuse of topc is fuse of topc;
if tempfuse of topc > 100, now tempfuse of topc is 5;
[ This must be something that's already been discussed, so don't reveal that it's a topic; just print the word. ]
otherwise;
say "[keyword name of topc]";
end if;
if final release mode is false and keyword name of topc is "", say "**";
if keyword name of topc is "", say printed name of topc;
if conversation is being debugged, say "*([printed name of topc]:[tempfuse of topc])".
Definition: a thing (called topc) is legit: let dis be 0; if last beat is topc, decide no; if topc is spoken, now dis is 1; if dis is 0 or topc is repeatable or topc is replaced by something legit, decide yes; decide no.
Rule for printing the name of a beat (called topic) while nicename topics is true: if keyword name of topic is not "", say keyword name of topic; otherwise say printed name of topic.
A beat has some text called the reaction. [ What is printed when the beat is discussed. ]
A beat has a beat called yes-beat. The yes-beat of a beat is usually silence. A beat has a beat called no-beat. The no-beat of a beat is usually silence. A beat has a beat called maybe-beat. The maybe-beat of a beat is usually silence. A beat has a beat called both-beat. The both-beat of a beat is usually silence. A beat has a beat called neither-beat. The neither-beat of a beat is usually silence. [ Note that these need to be given an explicit keyword name of "yes" or whatever. (Why?)]
A beat has a number called fuse. The fuse of a beat is usually 3. A beat has a number called tempfuse. [ Newly summoned beats expire after a certain number of turns. ]
Definition: a beat is available if its tempfuse > 0. Definition: a beat is unavailable if it is not available. [ An available beat is relevant to speak about at the present moment. ]
A beat is either spoken or unspoken. A beat is usually unspoken. [ This tracks whether we have discussed the beat. We don't use Inform's built in "we have discussed" because it's too inflexible; sometimes we want to pretend we've discussed something when we actually haven't, and a beat might incorrectly be marked as "discussed" by Inform even if it didn't make it through our routines to actually having printed something.]
A beat is either repeatable or unrepeatable. A beat is usually unrepeatable. [ Most beats can only be said once. ]
A beat is either ephemeral or substantial. A beat is usually substantial. [ Ephemeral beats are for tangents or asides which do not affect the main flow of the conversation, which continues immediately after printing them. ]
A beat is either terminal or interstitial. A beat is usually interstitial. [ A terminal beat marks a possible endpoint of a conversation. ]
A beat is either verbal or nonverbal. A beat is usually verbal. [ Most beats are spoken aloud, and it thus makes sense for others to be described as "listening" for instance. Some beats either immediately suggest something else or encode a nonverbal response. ]
Importance is a kind of value. The importances are insistent, dogged, or casual. A beat has an importance. The importance of a beat is usually casual. [ An insistent beat means that the NPC expects an answer, and all other active beats are squelched. A dogged beat is one that keeps the preceeding insistent beat's answers available. ]
A beat is either exciting or average. A beat is usually average. [ Some beats will be brought up by the NPC as soon at the player gives them a chance to get a word in. ]
Affinity-tone is a kind of value. The affinity-tones are affinitive, unaffinitive, and affinity-neutral. A beat has an affinity-tone. The affinity-tone of a beat is usually affinity-neutral. Paternal-tone is a kind of value. The paternal-tones are paternal, unpaternal, and paternal-neutral. A beat has an paternal-tone. The paternal-tone of a beat is usually paternal-neutral. Submissive-tone is a kind of value. The submissive-tones are submissive, unsubmissive, and submissive-neutral. A beat has an submissive-tone. The submissive-tone of a beat is usually submissive-neutral. Romantic-tone is a kind of value. The romantic-tones are romantic, unromantic, and romantic-neutral. A beat has an romantic-tone. The romantic-tone of a beat is usually romantic-neutral. Annoyance-tone is a kind of value. The annoyance-tones are annoying, impressive, and annoying-neutral. A beat has an annoyance-tone. The annoyance-tone of a beat is usually annoying-neutral. [ Beats can change Progue's attitude towards the player. ]
The last beat is a beat that varies. The actual last beat is a beat that varies. The penultimate beat is a beat that varies. [ The next beat is a beat that varies.] Silence is a beat. The last beat is silence. [ The next beat is silence.] The penultimate beat is silence. [ Keeps track of the last thing said, and, sometimes, a queued response for the NPC to say when the player runs out of things to ask. ]
A person has a beat called unavailable-beat. The unavailable-beat of a person is usually silence. [ Sets what the NPC should do if the player tries to refer to a no-longer-relevant beat. ]
Summoning relates various beat to various beats. The verb to summon (he summons, they summon, he summoned, it is summoned) implies the summoning relation. [ Beats can bring other beats into play by making them available. ]
Suggesting relates various beats to one beat. The verb to suggest (he suggests, they suggest, he suggested, it is suggested) implies the suggesting relation. [ A throughline should be defined for every beat, which tells the NPC how to continue the conversation if the player is silent. ]
Replacing relates one beat to various beats. The verb to replace (he replaces, they replace, he replaced, it is replaced) implies the replacing relation. [ An individual beat may only be seen once per game (unless it is repeatable). Replacing explains which beat should be used if the beat requested has already been said. If none is specified, the character will reply with his unavailable-beat. ]
Enqueuing relates various beats to one beat. The verb to enqueue (he enqueues, they enqueue, he enqueued, it is enqueued, he is enqueuing) implies the enqueuing relation. [ Some beats move immediately on to a next beat before the player has as chance to react. ]
Canceling relates various beats to various beats. The verb to cancel (he cancels, they cancel, he canceled, it is canceled) implies the canceling relation. [ Beats can make other beats no longer available, useful for keeping the player from changing their answer to a question. ]
Referencing relates one thing to various beats. The verb to reference (he references, they reference, he referenced, it is referenced) implies the referencing relation. [ Beats can refer to objects; by using the DISCUSS verb, we can see a list of the most recent objects we've encountered that this NPC has conversation topics for. ]
A thread is a kind of container. A thread is usually closed, unopenable, and transparent. [ A thread is a group of related beats, representing one conversation. They are tied together via the suggesting and replacing relations. ]
[ A procedural rule (this is the ignoring basic accessibility for beats rule): if we are discussing or exhausting and the noun is a beat, ignore the basic accessibility rule. ][ Beats do not conform to the usual scope rules. ] [ moved to the my-basic-accessibility rule definition.]
A thread has a beat called the escape clause. The escape clause of a thread is usually default_escape_clause. [ If a conversation stalls out due to bad programming or an unexpected condition, the escape clause contains a way to gracefully end it unexpectedly. Really, this is always a programming problem, but hopefully in the worst case scenario where it appears, keeps the game from appearing broken. ]
default_escape_clause is a beat with reaction "'I've lost my train of thought,' [the random other person in the location] says. (Error: no conversation beat.)".
[ We never want to have to disambiguate between beats, since they are not named. Thus, we intelligently figure out which one the player is talking about. As long as we never introduce two beats that can be referred to with the same word on the same turn, this should work. ]
[ According to vaporware, "only the best matching rule for each object actually matters." ]
Definition: a thing is sequitous if it is in a random thing that encloses penultimate beat.
Definition: a beat is potent if its tempfuse is its fuse - 1.
Definition: a beat is relevant if it is available or it is sequitous.
[
Beats are assumed to have priority in the following order:
-- In same thread as last beat and summoned by the last beat spoken
-- Not in same thread as last beat but summoned by last beat spoken
-- In same thread as last beat and still available
-- Not in same thread as last beat but available
-- Not available.
Unavailable beats are never matched, just return an error message.
]
Does the player mean doing something with a beat (called gambit):
if gambit is unavailable, it is very unlikely;
if gambit is not potent and gambit is not sequitous, it is unlikely;
if gambit is not potent, it is possible;
if gambit is not sequitous, it is likely;
it is very likely.
[ If the player tries to type a beat when not in conversation, or one that would mistakenly produce a disambiguation message, prevent them.]
Rule for asking which do you mean while discussing [ and final release mode is true]:
if conversation is being debugged, say "// Conversation: rule for asking which do you mean.";
let joe be a random conversing person enclosed by the location;
if joe is a person and the unavailable-beat of joe is not silence, force discuss the unavailable-beat of joe;
otherwise say "[if a dream presence is enclosed by location]You can't see or hear it, but you know somehow it's there[else if an other person is enclosed by location][as the parser]It's no longer a good time to talk about that[as normal][otherwise][as the parser]The noun you used was either misspelled, not something I know about, or not nearby[as normal][end if].";
now disambiguation_flag is true. [ This will override the disambiguation question.]
To extend beats:
repeat with item running through available beats:
increase tempfuse of item by 1.