gwelks: Nigel Jayne's Interactive Fiction Site

Source Text for Sequitur

Book - Activities and Rulebooks

Chapter - Activities from Standard Rules

Rule for printing the banner text:

if location does not contain a candidate song begin;

unless Office contains player, say "[seq][lb]";

say "[b][story title][/b] Version [release number] by Tin Foil Jenny Technology with the assistance of Nigel Jayne. [lb][story headline]. Copyright [unicode 169] [story creation year] by [story author]. LICENSE shows copyright information. [lb]All rights reserved. Serial number [story serial number] / Inform 7 build [I7 version number][lb]COVER shows the cover art, with text description, by Chris Elkjar.";

end if.

After deciding the scope of the player during Investigation:

place Nigel in scope;

say rpo.

Before reading a command when turn count is 45, now Jennifer is not having lunch.

Before reading a command when player is not queried during Investigation:

if (bites remaining is hot dog length) and ((the turn count is less than 35 and turn count is greater than ten and a random chance of 1 in 12 succeeds) or (the turn count is greater than 35 and the turn count is less than 60 and a random chance of 1 in 8 succeeds) or (the turn count is greater than 60 and a random chance of 1 in 5 succeeds)) begin;

say "[if interjection needed is true][interjection] [lb][end if]Cochone [one of]blinks his itchy eyes[or]sniffs, then rubs his eyes[or]coughs[or]wipes his damp forehead[or]sighs and breathes deeply. He seems a bit out of breath[or]hears ringing in his ears[or]shifts in his seat to relieve his aching legs[or]stretches his sore fingers[purely at random]";

say "[if Cochone is remembering search]. He [otherwise]. [lb]";

otherwise;

if Cochone is remembering search, say "Cochone ";

end if;

if Cochone is remembering search begin;

say "leans back. ";

repeat with counter running from one to the number of rows in the Table of Memories begin;

choose row counter in the Table of Memories;

if there is a Memory Trigger entry and Memory Trigger entry is positioned begin;

say "[memory entry] [lb]";

blank out the Memory Trigger entry;

end if;

end repeat;

now Cochone is not remembering search;

end if;

now interjection needed is false.

Before reading a command when already speaking is true, now already speaking is false.

Table of Memories

Memory TriggerMemory
Basement"He remembers searching the basement, shifting some debris, and being choked by a puff of acrid smoke."
Dead Animals"He remembers watching techs bagging the carcasses from the trees beside the house. [i]There was that residue around the vent beside the window.[/i] He also recalls gliding a finger through the glittering contamination on the pipe and choking on the acrid odor."

Lunch request counter is initially zero.

First after reading a command when the player is queried:

if the accessible text of the player's command matches the regular expression "^n$|^answer no$", change the text of the player's command to "no";

if the player's command matches "anser yes", change the text of the player's command to "yes";

unless the player's command matches "listen/y/yes/no" or the accessible text of the player's command matches the regular expression "^(say yes)$|^(say no)$", case insensitively begin;

if the location contains a candidate song begin;

if player is considerate begin;

say "Cochone rubs his eyes and sighs. [pb]Jenny jumps in before he can proceed. 'This is going to happen, Columbo, whether you want to participate or not. So, are you going to pick a song?'";

now player is hesitant;

reject the player's command;

end if;

if the player is hesitant begin;

say "'Oh, come on,' Jenny says. 'It's not like I am going to ask you to choose Eminem or Pitbull or anything like that.'";

now player is reconsiderate;

reject the player's command;

end if;

if the player is reconsiderate begin;

now the player is dismissive;

change the text of the player's command to "no";

end if;

otherwise;

if lunch request counter is less than two begin;

if the player's command includes "tell nigel/jayne/boss yes/no" begin;

if the player's command includes "yes", change the text of the player's command to "yes";

if the player's command includes "no", change the text of the player's command to "no";

otherwise;

say "'[one of]Let's keep it simple, Steve,' Nigel says. '[']Yes['] or [']no.[']'[or]Wrong answer. Try again.'[stopping] [lb]";

increment lunch request counter;

reject the player's command;

end if;

otherwise;

say "Nigel screws up his face. 'You okay?' [pb]'Yeah,' Cochone says. He considers his churlish stomach. [pb]'So ... the verdict?' [pb]";

change the text of the player's command to "no";

end if;

end if;

end unless.

[This is necessary because "move" in grammar lines for insert doesn't work correctly in this source.]

First after reading a command when the accessible text of the player's command matches the regular expression "^move\s" during Investigation:

let t be text;

let t be the accessible text of the player's command;

replace the regular expression "^move" in t with "put";

change the text of the player's command to t.

First after reading a command:

remove stray punctuation.

[This rule is actually listed first because Inform runs through rules that are listed first in reverse order as they are mentioned in the source text. When the compiler reaches a "First ... " rule, it ranks it first in the rulebook. When it encounters another, it then places the new "First ... " rule first in the rulebook, bumping the previous to second. This process repeats for every "First ... " rule as the compiler runs through the text.]

After reading a command when the accessible text of the player's command matches the regular expression "\ball$|\ball\b" during Investigation:

unless the player's command includes "click/pick/choose/select/play/p" or the player's command includes "click on" or the accessible text of the player's command matches the regular expression "^cut\b|^excise\b|^remove\b" begin;

say "Cochone decides to try to focus his thoughts onto just one thing.";

reject the player's command;

end unless.

After reading a command when the accessible text of the player's command matches the regular expression

"^(add|put|insert|place)\s*" and the accessible text of the player's command matches the regular expression "between\s*" and the accessible text of the player's command matches the regular expression "and\s*" during Investigation:

say "[seq] You can simply type the slot you want to put the track into, but you do need to specify the slot ('put three in c,' for example; 'between ... ' doesn't tell me exactly where to put the track). [pb] [seq]";

reject the player's command.

[We use this to store a track or position into a variable and truncate the action when the action uses three nouns, e.g., inserting a track through a track into a slot.]

Inserting group left is initially false.

Inserting group right is initially false.

[Matching the player's command with a string of text won't work with two tokens, e.g., "a track to the left of a track."]

After reading a command when the accessible text of the player's command matches the regular expression "^(add|put|insert|place)\s*\s" and (the player's command includes " and " or the player's command includes "[a track] through/to/with " or the player's command includes "[a position] through/to/with " or the player's command includes "[a number] through/to/with ") during Investigation: ["and" signals the end of an action when combined with a token, e.g., "if the player's command includes "<a thing> and" skips ahead to a parser error.]

if the player's command includes "to/with/through [a track]" or the player's command includes "to/with/through [a number]" or the player's command includes "to/with/through [a position]" begin;

let manipulated be the accessible text of the player's command;

now substitution track is zero;

now substitution slot is placeholder;

if the player's command includes "[a number] in/to/-- the/-- after/ahead/forward/front/right after/of/--" or the player's command includes "[a thing] in/to/-- the/-- after/ahead/forward/front/right after/of/--", now inserting group right is true;

if the player's command includes "[a number] in/to/-- the/-- behind/before/left of/--" or the player's command includes "[a thing] in/to/-- the/-- behind/before/left of/--", now inserting group left is true;

if inserting group right is true or inserting group left is true or manipulated matches the regular expression "\s(in\s|into\s|on\s|onto\s)*" begin;

replace the regular expression "^(add|insert|place|put)" in manipulated with "group";

if manipulated matches the regular expression "\s(1|one)$", now substitution track is 1;

if manipulated matches the regular expression "\s(2|two)$", now substitution track is 2;

if manipulated matches the regular expression "\s(3|three)$", now substitution track is 3;

if manipulated matches the regular expression "\s(4|four)$", now substitution track is 4;

if manipulated matches the regular expression "\s(5|five)$", now substitution track is 5;

if manipulated matches the regular expression "\s(6|six)$", now substitution track is six;

if manipulated matches the regular expression "\s(7|seven)$", now substitution track is 7;

if manipulated matches the regular expression "\s(8|eight)$", now substitution track is 8;

if manipulated matches the regular expression "\s(9|nine)$", now substitution track is 9;

if manipulated matches the regular expression "\s(10|ten)$", now substitution track is 10;

if manipulated matches the regular expression "\s(11|eleven)$", now substitution track is 11;

if manipulated matches the regular expression "\s(12|twelve)$", now substitution track is 12;

if manipulated matches the regular expression "\s(13|thirteen)$", now substitution track is 13;

if manipulated matches the regular expression "\s(14|fourteen)$", now substitution track is 14;

if manipulated matches the regular expression "\s(15|fifteen)$", now substitution track is 15;

unless substitution track is 0 begin;

replace word number (number of words in manipulated) in manipulated with "";

replace the regular expression "\s$" in manipulated with "";

otherwise;

if manipulated matches the regular expression "\s\w$" begin;

let t be a text;

now t is "[character number (number of characters in manipulated) in manipulated in upper case]";

replace the regular expression "\s\w$" in manipulated with "";

repeat with substitutor running through positions begin;

if the printed name of substitutor is t, now substitution slot is substitutor;

end repeat;

otherwise;

say "[seq]You'll need to specify a slot letter to place them next to. [end seq] [lb]";

now inserting group left is false;

now inserting group right is false;

reject the player's command;

end if;

end unless;

if substitution slot is a position or (substitution track is less than 16 or substitution track is greater than zero) begin;

replace the regular expression "\s(after|(to the right of)|(to right of)|(right of)|(right after))\s*" in manipulated with "";

replace the regular expression "\s((in front of)|(ahead of)|(forward of))\s*" in manipulated with "";

replace the regular expression "\s(before|(to the left of)|(to left of)|(left of)|left|behind)\s*" in manipulated with "";

replace the regular expression "\s(in|into|on|onto)$" in manipulated with "";

replace the regular expression "\sand\s" in manipulated with " to ";

change the text of the player's command to manipulated;

otherwise;

say "[seq] You'll need to use either a slot letter or track number with that command, e.g., 'put 1 to 3 after c.' [pb] [end seq]";

reject the player's command;

end if;

end if;

end if.

After reading a command when the player's command matches "random" during Investigation:

change the text of the player's command to "play sequence randomly".

After reading a command when the accessible text of the player's command matches the regular expression "slot\s\d$|position\s\d$" during Investigation:

say "[seq] Slots are lettered A through J. [pb][end seq]";

reject the player's command.

After reading a command during Investigation (this is the substitutions rule):

if the accessible text of the player's command matches the regular expression "\bcp$|\bsr$|\bvr$|\bcp1$|\bcp2$|\bvr1$", case insensitively begin;

say "[seq]Please be more specific about which of the tracks you want. [pb][end seq]";

reject the player's command;

end if;

let replaced be the accessible text of the player's command;

[these will allow the player to type the specific slot by itself without trying the going action.]

replace the regular expression "(?i)^d$" in replaced with "fourth";

replace the regular expression "(?i)^e$" in replaced with "fifth";

change the text of the player's command to "[replaced]";

replace the regular expression "(?i)\ba$" in replaced with "first";

change the text of the player's command to "[replaced]";

[We search for "and" when the action is exchanging, and replace it with "with.". we need to replace the conjunction because the parser assumes we want the switching action when "and" is used, and we therefore get a parser error.]

let replaced be the accessible text of the player's command;

if replaced matches the regular expression "^exchange\b|^switch\b|^reverse\b", case insensitively begin;

replace the regular expression "\band\b" in replaced with " with ";

change the text of the player's command to "[replaced]";

end if;

let replaced be the accessible text of player's command;

if replaced matches the regular expression "(?i)^jenny,.*squirrel$|^Jennifer,.*squirrel$" begin;

replace the regular expression "squirrel" in replaced with "injured squirrel";

change the text of the player's command to replaced;

end if;

if the player's command includes "tracks", replace the matched text with "footage".

[Tracks as a synonym for footage leads into disambiguation problems and failure.]

[The parser recognizes "one a" as a command to examine a track in A slot instead of shorthand for inserting. This rule fixes that tendency.]

After reading a command when the player's command matches "one/1 a":

change the text of the player's command to "put one in a".

The parser clarification internal rule response (B) is "[seq] Which do you mean, ".

The parser clarification internal rule response (E) is "What do you want [if the noun is not the player][the noun] [end if]to [parser command so far]? [pb][end seq]".

Before printing a parser error during Investigation:

unless the player's command is Cochone-related, say "[seq]".

First for printing a parser error when the player's command is Cochone-related:

if the accessible text of the player's command matches the regular expression "^kiss", say "Cochone will only kiss women.";

otherwise say "Cochone is momentarily confused and tries to think of something more appropriate.".

Rule for printing a parser error when the latest parser error is the can't see whom to talk to error:

say "Cochone doesn't see anyone of that name.".

Rule for printing a parser error when the latest parser error is the only understood as far as error during Investigation:

say "You don't need the second 'something' in that command.".

Rule for printing a parser error when the latest parser error is the can't see any such thing error during Investigation:

if the player's command includes "add/insert/place/put [something] with/and/through", say "You'll need to also specify a second track and where you want to put the tracks.";

otherwise say "That isn't related to the [i]Sequitur[/i] program, or I haven't learned to recognize it.".

Rule for printing a parser error when the latest parser error is the not a verb I recognise error during Investigation:

if the player's command includes "[a number]" and the accessible text of the player's command matches the regular expression "^x\b|^examine\b|^play\b", say "There are only 15 tracks.";

otherwise say "Type 'commands' to see a list of commands that I understand.".

Rule for printing a parser error when the latest parser error is the can't use multiple objects error during Investigation:

if the player's command includes "add/insert/place/put [something] with/through", say "You'll need to also specify a second track and where you want to put the tracks.";

otherwise say "That command accepts only one noun.".

Rule for printing a parser error when the latest parser error is can only use multiple objects error during Investigation:

say "That command needs two nouns.".

Rule for printing a parser error during Investigation:

say "I'm sorry, but I didn't understand that.".

Rule for printing a parser error when location contains a candidate song:

say "Cochone sighs and decides to consider Jenny's proposal.".

Rule for printing a parser error when Investigation has ended:

say "Cochone rubs his eyes and tries to keep his mind from straying to far from the case.".

After printing a parser error when already speaking is true:

if the latest parser error is the I beg your pardon error, say "I haven't developed software that can read your mind, not yet anyway. So, please type something.";

say "[lb][end seq]".

[We need to put the I beg your pardon error here because, for some reason, it won't trigger as its own rule.]

Before supplying a missing noun when Investigation is happening:

unless stalling or the player's command matches the regular expression "(?i)^jenny|jennifer", say "[seq]".

Before supplying a missing second noun during Investigation:

unless stalling or the player's command matches the regular expression "(?i)^jenny|jennifer", say "[seq]".

Rule for supplying a missing noun:

unless already speaking is false or Investigation is not happening, say "Please supply a noun for that action. [lb]";

otherwise say "Cochone thinks about what he wants to do that to. [lb]".

Rule for supplying a missing second noun:

if (the player's command includes "look up" or the player's command includes "research") and the accessible text of the player's command matches the regular expression "^jenny|^jennifer", case insensitively begin;

if noun is nothing begin;

try talking about topic understood with Jennifer instead;

otherwise;

try researching with the internet about the noun instead;

end if;

end if;

[The parser won't plug in a second noun when asking someone to try doing something.]

unless already speaking is false or Investigation is not happening begin;

say "Please supply a second noun for that action. [lb]";

otherwise;

say "[i]How should I complete that?[/i] Cochone thinks. [lb]";

end unless.

Before asking which do you mean during Investigation:

unless the player's command is cochone-related,say "[seq]".

After asking which do you mean during Investigation:

unless the player's command is cochone-related, say "[end seq]".

The parser clarification internal rule response (B) is "[unless the player's command is cochone-related]Which do you mean, [otherwise]Cochone wonders which one he wants, [end unless]".

Rule for clarifying the parser's choice of something:

stop.

Rule for deciding whether all includes something (called target) while clicking:

if target is a not on-screen thing, it does not;

if target is a not intractable thing, it does not;

if target is playlist, it does not;

if two tracks are positioned begin;

if target is footage, it does not;

otherwise;

if target is sequence, it does not;

end if.

Rule for constructing the status line when Investigation is happening or Investigation has ended:

fill status bar with Table of Fancy Status;

rule succeeds.

Rule for constructing the status line:

do nothing.

Table of Fancy Status

LeftCentralRight
"""[if Workstation contains player][fiction title][otherwise if the story has ended finally]Bonus Tracks[otherwise if Investigation has ended]Track 16[end if]"""

Chapter - New Activities

Recalling the link for something is an activity on things. Recalling the link activity has a text called previous event. Recalling the link activity has a text called event.

[This prints explanations as to why clips fit together.]

First before recalling the link for a track (called target):

now previous event is "'[appropriate name for a random track which links target]'";

now event is "'[appropriate name for target]'".

Connections made is initially one.

before recalling the link for a track (called target):

let source be the list of tracks;

let comparer be a list of things;

let first continuous streak be {backyard, Dead Animals, Time Lapse};

if target is listed in first continuous streak, now comparer is first continuous streak;

let second continuous streak be {Kitchen, Diary, Chrysanthemum};

if target is listed in second continuous streak, now comparer is second continuous streak;

let third continuous streak be {Fight, Escape, Torching};

if target is listed in third continuous streak, now comparer is third continuous streak;

if target is continuous and target is entry three in comparer and entry one in comparer links entry two in comparer and entry two in comparer links entry three in comparer begin;

say "[italic type][if connections made is greater than one]And some of these others fit[otherwise]I think some of these fit together,[Roman type] [end if]Cochone realizes. [italic type]Tracks [if target is Chrysanthemum][number-name of Kitchen][otherwise if target is Time Lapse][number-name of Backyard][otherwise][number-name of Fight][end if] through [number-name of target]. ";

increment connections made;

now entry 1 in comparer is explained;

now entry 2 in comparer is explained;

now target is explained;

otherwise;

if target is not continuous or target is Fight begin;

say "[if connections made is greater than two][i]And even some more,[/i] Cochone says[otherwise if connections made is two][i]There are more here,[/i] Cochone concludes[otherwise][i]I think I have a link,[/i] Cochone realizes[end if]. [italic type]Track [number-name of a random track which links target] and Track [number-name of target]. ";

increment connections made;

now target is explained;

end if;

end if.

After recalling the link for something (called target) when target is neither Diary nor Dead Animals nor Escape:[We don't wantg this announcement when the middle track of a segment of three is linked for the beginning of the short and long segments and for the end of the long segment.]

say Roman type;

say "'[one of]I think I have a connection,' Cochone says. 'I like [or]Let's link [stopping]";

if target is either Chrysanthemum or Time Lapse or Torching begin;

say "[if target is Chrysanthemum][number-name of Kitchen] to [number-name of Diary] to [number-name of Chrysanthemum][otherwise if target is Time Lapse][number-name of Backyard] to [number-name of Time Lapse] by way of [number-name of Dead Animals][otherwise][number-name of Fight] and [number-name of Escape] and [number-name of Torching][end if]";

otherwise;

say "[number-name of a random track which links target] with [number-name of target]";

end if;

say ". [one of]Can you remember that for me?' [pb]'Sure,' Jenny says and types on her keyboard. 'Okay, now all you need to do is type [']remember,['] and the links you've figured out will appear on your screen.' [pb]'Great.' [pb]'That's why I'm here.' [or]Okay?' [pb]'Gotcha,' Jenny says. [stopping] [lb]";

now interjection needed is true.

Chapter - New Rulebooks

Linker rules is an object-based rulebook. Linker rules have outcomes link established (success) and disjointed (failure - the default).

[This decides if two consecutive tracks in the Sequence should be linked with the linkage relation.]

Linker rule for something:

link established.