Hadean Lands: Main Story

Copyright 2014-6 by Andrew Plotkin.

This source code is provided for personal, educational use only. The story and text of Hadean Lands belong to me; you may not use them or create derivative works which contain them. However, you have permission to use the programming techniques of this game in your own works, and you may use the source code excluding game text.



"Hadean Lands" by Andrew Plotkin.
[IFID: 47efef42-e2f2-4675-ada2-5a5942a0870a]
 
The story headline is "Overdue Interactive Fiction".
The story creation year is 2014.
The story genre is "Fantasy".
 
Include (-
Constant Story_Attribution "Copyright (c) 2014-6 by Andrew Plotkin";
-) before "Banner" in "Printing.i6t".
 
The release number is 5.
Include (-
! Serial "160522";  ! Manual serial number
-) after "Identification" in "Output.i6t".
 
Release along with cover art.
 
Use MAX_OBJECTS of 1500.
Use MAX_DICT_ENTRIES of 3000.
Use MAX_SYMBOLS of 40000.
Use MAX_PROP_TABLE_SIZE of 500000.
Use MAX_LABELS of 30000.
Use ALLOC_CHUNK_SIZE of 32768.
Use MAX_NUM_STATIC_STRINGS of 30000.
Use slow route-finding.
Use memory economy.
Use OMIT_UNUSED_ROUTINES of 1.
 
[This silliness prevents the compiler from generating gameinfo.dbg, which is slow and we don't care about it.]
Include (-!% -~k
!% -z
-) before "ICL Commands" in "Output.i6t".
 
Include HL Mechanism by Andrew Plotkin.
Include HL Ritual by Andrew Plotkin.
Include HL Gen Goals by Andrew Plotkin.
Include HL Tutorial by Andrew Plotkin.
 
 
Chapter - Implementation Hooks
 
Section - Reset Rules
 
The reset the player's situation rule is listed after the reset visited and handled rule in the reset rulebook.
Reset rule (this is the reset the player's situation rule):
    [Initial unlocks -- cumulative. (These stanzas match the game goals rules, except we don't bother with prereqs.)]
    if not post-game:
        if chapter-0-done:
            now the rosemary is in 2nd-lab; [not handled, same room]
            now the player carries the steel-bolt;
            now the steel-bolt is handled;
            now the 2nd-hatch is clean;
            now the 2nd-hatch is ever-tried;
            now the 2nd-hatch is open;
            now the 2nd-Lab is visited-this-cycle;
        if chapter-1-done:
            retire the pinecone by ritual in the 2nd-Lab;
            now the mech-hatch is clean;
            now the mech-hatch is open;
            now the chem-hatch is unlocked;
            now the lock-counter of the chem-hatch is zero;
            now the chem-hatch is open;
            now the herb-hatch is open;
            now the mushroom is in the Chem-Lab;
            now the mushroom is handled;
            now the saline is in the Chem-Lab; [not handled, same room]
            now the mech-door is not dirty;
            now the mech-door is open;
            now the 2nd-Crawl is visited-this-cycle;
            now the Mech-Crawl is visited-this-cycle;
            now the Herb-Crawl is visited-this-cycle;
            now the Chem-Crawl is visited-this-cycle;
            now the Herbarium is visited-this-cycle;
            now the Mech-Lab is visited-this-cycle;
            now the Chem-Lab is visited-this-cycle;
        if chapter-2-done:
            [Note that at this point, syn-gaps might be fixed.]
            [Given that, the pinecone could theoretically still be present. Pretend the player hasn't noticed that.]
            now the saline is in the Chem-Lab;
            now the saline is handled;
            [Don't bother shifting ginger or peppermint.]
            retire the fire-resistance by drinking in the Fire-Lab;
            now the player carries the hall-key;
            now the hall-door is unlocked;
            now the hall-door is open;
            now the Lab-Hall-SW is visited-this-cycle;
            now the Lab-Hall-SE is visited-this-cycle;
            now the Lab-Hall-NW is visited-this-cycle;
            now the Lab-Hall-NE is visited-this-cycle;
            now the Fire-Lab is visited-this-cycle;
            now the Lab-Wing-Hall is visited-this-cycle;
            now the East-Side-Hall is visited-this-cycle;
            now the Nave is visited-this-cycle;
    [Initial positions -- not cumulative, obviously.]
    if not chapter-0-done:
        move the player to the 2nd-Lab, without printing a room description;
    else if not chapter-1-done:
        say "(You hurry through the saturation ritual, un-rust the hatch, and open it.)";
        move the player to the 2nd-Lab, without printing a room description;
    else if not chapter-2-done:
        say "[bold][2nd-Lab][/bold][br]";
        say "(You make your way to [the Chem-Lab], brew the fungicide, and open [the Mech-Lab] door.)";
        move the player to the Mech-Lab, without printing a room description;
    else if not post-game:
        say "[bold][2nd-Lab][/bold][br]";
        say "(You make your way back to the Nave.)";
        move the player to the Nave, without printing a room description;
    else:
        [Awkward to do this here, but this is the last-ever reset.]
        now all rooms are not visited;
        now all things are not ever-seen;
        move the player to Endgame-1, without printing a room description;
    now the Abstraction Layer is not visited;
    [This is normally an end-of-turn rule, but we either just started the game or we skipped the end-of-turn phase due to reset.]
    follow the return-room setting rule.
 
Reset rule (this is the reset object locations rule):
    now the paper-bundle is off-stage;
    now the brass-pin is in 2nd-lab-table;
    now the steel-bolt is in the 2nd-Lab;
    now the calipers are in 2nd-lab-table; now the calipers are dirty;
    now ginger-impet is in 2nd-lab-table;
    now peppermint-impet is in 2nd-lab-table;
    now citronelle-impet is in Chem-Lab;
    now kelp-impet is in Deck-Suite;
    now eucalyptus-impet is in Med-Wing;
    now the convex-lens is in the opt-store-bin; [in Opt-Store]
    now the concave-lens is in the opt-store-bin; [in Opt-Store]
    now the el-earth is part of the glass-heap; [in Opt-Lab]
    now the el-water is on the compass; [in Observatory]
    now the feather is in the Opt-Store;
    now the glass-loop is in Mech-Lab;
    now the rock-salt is on the mech-counter; [Mech-Lab]
    now the fluorite is in the materials-bin; [Mech-Store]
    now the long-quartz is in the materials-bin; [Mech-Store]
    now the broad-quartz is in the materials-bin; [Mech-Store]
    now the H-chime is in Mech-Store;
    now the G-flat-chime is in Lab-Wing-Hall;
    now the F-sharp-chime is part of the tilt-slab; [on the far end]
    now the B-chime is in Scaphe-Crawl; [flooded!]
    now the mercury is in Out-Ship;
    now all metal-wires are off-stage;
    now all metal-rods are off-stage;
    now all metal-seals are off-stage;
    now the rutilum-seal is in Safe-Nook;
    now the iron-bead is on the mech-counter; [Mech-Lab]
    now the lead-rod is on the fire-store-rack; [Fire-Store]
    now the nickel-rod is on the mech-counter; [Mech-Lab]
    now the platinum-rod is on the mech-counter; [Mech-Lab]
    now the moon-metal-rod is in the materials-bin; [Mech-Store]
    now the phlo-gold is in the gold-cabinet;
    now the rosemary is in the 2nd-lab-table;
    now the honeysuckle is on the herb-shelf; [Herbarium]
    now the mushroom is on the herb-shelf; [Herbarium]
    now the pinecone is on the herb-shelf; [Herbarium]
    now the mustard is off-stage; [supply in Herbarium]
    now the zafranum is in the Herbarium;
    now the coral is off-stage;
    now the ash is off-stage; [supply in Charred-Hall]
    now the silver-coin is on the fire-store-rack; [Fire-Store]
    now the horn-coin is on the scaphe-bench; [Exoscaphe]
    now the brass-coin is in the Chem-Lab;
    now the measuring-block is in the Scaphe-View;
    now the ivory-bead is in the Basement;
    now the tao-amulet is in the Study-Room;
    now the infotater is in the Library; now the weather-symbol of the infotater is snowy-day;
    now the orichalcum is in the store-safe;
    now the silver-chain is on the store-shelves; [Safe-Store]
    now the silk-cord is on the store-shelves; [Safe-Store]
    now the rough-diamond is on the store-shelves; [Safe-Store]
    now all wood-splints are on the fire-table; [Fire-Lab]
    now the cedar is off-stage;
    now the paten is in the kiln;
    now the hall-key is in the kiln;
    now the scratched-bubble is in Med-Lab;
    now the dusty-bubble is in Opt-Closet;
    now the torch-lighter is in Under-Ward;
    now the scalpel is in Med-Wing;
    now the sandstone-pebble is in the materials-bin; [Mech-Store]
    now the granite-pebble is in the materials-bin; [Mech-Store]
    now the obsidian-pebble is in the materials-bin; [Mech-Store]
    now the flint-pebble is in the opt-store-bin; [in Opt-Store]
    now the marble-pebble is in Scaphe-View-North;
    now the basalt-pebble is in the Mineral-Maze;
    now the jade is in the Mineral-End;
    now the labyrinth-tile is in Junior-Quarters;
    now the baros-key is in Arms-Quarters; [syn-gap from Deck Suite.]
    now the 3rd-key is in Scaphe-Dome;
    now all chem-vials are off-stage;
    now the anti-Tellurian-dist is in the 3rd-Lab;
    now the nickel-filings is in the 3rd-Lab;
    now all chem-flasks are on the chem-rack; [Chem-Lab]
    now the alcohol is in 2nd-Crawl;
    now the lubanja is in Chem-Crawl;
    now the alum is in Under-Ward;
    now the vitriolic is in Under-Ward;
    now the highlime is in Nave-Crawl;
    now the grey-dust is off-stage; [supply in Out-Plain]
    now the polar-oil is in the ship-niche;
    now all clay-molds are on cap-bunk; [Captain-Quarters]
    now the aithery-mold is in Med-Lab;
    now the blank-tin-slip is in the calc-slot;
    [created things]
    now the dispersal-brush is off-stage;
    now the planetary-lens is off-stage;
    now the oculus is off-stage;
    now the centrality-lodestone is off-stage;
    now the purity-lodestone is off-stage;
    now the perfect-diamond is off-stage;
    now the mark-tin-slip is off-stage; now the mark-tin-slip is incorrect; now the mark-tin-slip is unruined;
    now the counterweight is in the Observatory; now the counterweight is fastened; now the symbol-type of the counterweight is no-symbol;
    now the bridge-cable is in the Observatory;
 
Reset rule (this is the reset paper-sheet locations rule):
    [This function is split out of "reset object locations" for stupid tab-formatting reasons.]
    repeat with T running through all paper-sheets:
        let L be the home-location of T;
        [We could use a low-level routine here. Sheets can never be worn, or part of anything.]
        if L is nothing:
            remove T from play;
        else:
            now T is in L;
    now the local-memspark is nothing;
    now notice-memspark-flag is false;
    repeat with T running through all memsparks:
        now T is not prominent-scenery;
 
Reset rule (this is the reset everything else rule):
    clear out the paper-bundle;
    now the aura-cloud is not ever-tried;
    now the out-inferno is in Charred-Hall;
    now the out-inferno is not ever-tried;
    now the in-inferno is in Charred-End;
    now the far-inferno is in Grand-Stair;
    now the atmosphere of Charred-End is fire-atm;
    now the atmosphere of Scaphe-Bay is vacuum-atm;
    now the atmosphere of Scaphe-Dome is vacuum-atm;
    now the atmosphere of Exoscaphe is normal-atm;
    now the atmosphere of Airlock is normal-atm;
    now the bridge-end-west is not ever-tried;
    now the tilt-slab is in Chasm-Slab;
    now the try-counter of the tilt-slab is zero;
    now the current-count of the vacuum-entry-cycler is 1;
    [...doors...]
    [Note that all doors which can be locked, start locked. So we don't need to set any doors unlocked.]
    now the 2nd-hatch is closed; now the 2nd-hatch is dirty; now the 2nd-hatch is not ever-tried;
    now the herb-hatch is open;
    now the chem-hatch is closed; now the chem-hatch is locked; now the lock-counter of the chem-hatch is zero;
    now the mech-hatch is closed; now the mech-hatch is dirty;
    now the mech-door is closed; now the mech-door is dirty;
    now the opt-door is closed;
    now the 3rd-door is closed; now the 3rd-door is locked;
    now the hall-door is closed; now the hall-door is locked;
    now the fire-door is open;
    now the store-door is open;
    now the med-wing-door is open;
    now the capq-door is closed;
    now the recq-door is closed;
    now the marble-door is closed; now the marble-door is locked;
    now the scaphe-port is closed; now the scaphe-port is not shifted;
    now the dome-hatch is closed;
    now the obs-door is closed; now the obs-door is locked;
    now the obsidian-door is closed; now the obsidian-door is locked;
    now the bird-door is closed; now the bird-door is not ever-tried;
    now the ante-door is closed; now the ante-door is not ever-tried;
    now the baros-door is closed; now the baros-door is locked;
    now the deep-door is closed; now the deep-door is locked;
    now the sv-window is not ever-tried;
    now the p-window is not ever-tried;
    now the inner-door is open; now the inner-door is not shifted;
    now the outer-door is closed;
    now the alien-inner-door is closed;
    now the alien-outer-door is closed;
    now the a-window is clean;
    [...other miscellany...]
    now the store-safe is closed; now the store-safe is locked; now the lock-counter of the store-safe is zero;
    now the mech-cabinet is closed; now the mech-cabinet is dirty;
    now the gold-cabinet is closed; now the gold-cabinet is locked;
    now the nook-cabinet is closed; now the symbol-type of the nook-cabinet is no-symbol;
    reset the calculator symbols; now the lock-counter of the calculator is zero;
    now the sv-valve is closed;
    now the maze-script is off-stage;
    now the ship-niche is closed;
    now the ship-circle is in Out-Ship;
    now the nave-debris is not shifted; now the nave-debris is not ever-tried;
    now the coral-outcrop is not shifted; now the coral-outcrop is dirty;
    now the pool-slab is dirty;
    now the deck-cabinet is closed; now the deck-cabinet is locked;
    now the capq-cabinet is closed; now the capq-cabinet is locked;
    now the junior-fuse-cabinet is closed; now the junior-fuse-cabinet is dirty;
    now the scaphe-fuse-cabinet is closed; now the scaphe-fuse-cabinet is dirty;
    now the med-gunk-cabinet is closed; now the med-gunk-cabinet is dirty;
    [...room details...]
    now the fake-lab-door is closed;
    now the fake-chem-door is closed;
    now the fake-opt-door is closed;
    now the fake-arms-door is closed;
 
 
Section - Meta Text
 
To say epigraph (N - number):
    [Reformat to user styles and centered-text when iOS-UI? Nah.]
    say " [bold]'And the moon is of lightly moving, and the moon is planet of way;[/bold][br]  [em]and for that skill it giveth us will of kind for to move lightly and for to go divers ways,[br]  and to seek strange things and other diversities of the world;[br]  for the moon environeth the earth more hastily than any other planet.'[/em][br]    -- The Travels of Sir John Mandeville[br]";
 
Carry out abouting:
    say "[first time](For the authentic game credits experience, please scroll this text slowly upwards while humming a John Williams pastiche. When you're done, you may shout 'achievement unlocked!')[para][only]";
    say "I must first thank Graham Nelson and the rest of the Inform 7 team: Emily Short, David Kinder, Andrew Hunter, Toby Nelson, and many others. Inform is the tool I needed to build a game on this scale.[para]";
    say "Words, words, words... Thanks to Gunther Schmidl for suggesting 'Uhraufziehzauberer.' I borrowed the term 'fluorspar' (as a synonym for 'fluorite') from Graydon Saunders.[para]";
    say "The beta-testers were many and persistent. Thanks to Aaron Reed, Adri Mills, Andrew Schultz, Carolyn VanEseltine, Chris Cieslik, Doug Jones, Emily Short, Jason McIntosh, Jim Munroe, Justin de Vesine, Michael Duggan, Val Grimm, William Samuels, Yoon Ha Lee. (Bonus credit to Emily for being the first ever person to finish the game, and Chris for being I think the second.)[para]";
    say "The People's Republic of Interactive Fiction (Boston's IF society) has provided continual reassurance that my chosen field still exists.[para]";
    say "Musical support: SomaFM.com. Emergency crunch-time musical support: Grey Larsen and Cindy Kallet.[para]";
    say "A special shout-out to Jason Scott. In 2010 I asked him 'Should I do a Kickstarter?' and he said 'Hell yes.' All else follows.[para]";
    say "I did not know Bathsheba when I started [story title], but her insistence that I finish it has proven salutary. Thank you for everything.[para]";
    say "Finally, of course, thanks to all my Kickstarter patrons; type [fixed]'BACKERS'[/fixed] for the complete (long) list of names. You have all been tremendously patient and I am grateful for your support.[para]";
    stop the action.
 
Carry out help-requesting:
    if not escaped first room:
        instead invoke tutor-help-command;
    instead say "[parsermsg][story title] does not come with hints. If you're stuck, please join in the online discussion at [fixed]http://hadeanlands.com/help[em] . You might also want to type [excmd]COMMANDS[/excmd] to learn about commands that are particularly important in this game.[/parsermsg][br]";
 
Carry out command-requesting:
    say "[parsermsg][story title] uses the familiar set of text game commands:  [excmd]EXAMINE[/excmd], [excmd]TAKE[/excmd], [excmd]DROP[/excmd], and so on. If you're not familiar with these, please ";
    if iOS-UI:
        say "flip to the Help tab for a guide";
    else if Lectrote-UI:
        say "select the 'IF Reference Card' menu option for a guide";
    else:
        say "visit [fixed]http://hadeanlands.com/[em] for a guide";
    say ".[para]";
    say "You will also need some special commands to perform ritual magic effectively.[para]";
    say "[excmd]RECALL[/excmd]: List all the rituals, magic formulas, and random facts that you have learned. If these lists grow large, you may want to be specific: [excmd]RECALL RITUALS[/excmd], [excmd]RECALL FORMULAS[/excmd], [excmd]RECALL FACTS[/excmd]. (Or just [excmd]RITUALS[/excmd], [excmd]FORMULAS[/excmd], [excmd]FACTS[/excmd].)";
    say "[excmd]RECALL PLACES[/excmd] or [excmd]PLACES[/excmd]: List all the interesting places you've visited. (Omitting corridors and other minor locales.)";
    say "[excmd]RECALL THINGS[/excmd] or [excmd]THINGS[/excmd]: List all the objects you've found or created. (Not scenery; only things you can pick up and carry.)";
    say "[excmd]RECALL DOORS[/excmd] or [excmd]DOORS[/excmd]: List all the closed (or blocked) doors that you have not yet managed to open.";
    say "[excmd]RECALL (anything)[/excmd]: Remember the details of any ritual, formula, or fact that you have learned.";
    say "[excmd]RECALL (object)[/excmd]: Remember where any object in the game is.";
    say "[excmd]GO TO (anything)[/excmd]: Go directly to any room or object that you know about.";
    say "[excmd]GO BACK[/excmd] or [excmd]RETURN[/excmd]: Go directly to the last room that you were in. This works even after a long [excmd]GO TO...[/excmd] journey. (Not the same as [excmd]UNDO[/excmd]!)";
    say "[excmd]EXITS[/excmd]: List the ways out of your location.";
    say "[excmd]SAY (formula)[/excmd]: Speak a formula out loud, during a ritual.";
    say "[excmd]PERFORM (ritual)[/excmd]: Perform an entire ritual in one command. You can only do this after you have successfully completed the ritual at least once! In other words, the first time you do a ritual, you must follow the step-by-step instructions. After that, you can use the [excmd]PERFORM[/excmd] shortcut.";
    say "[excmd]CREATE (object)[/excmd]: Some rituals craft objects or potions. This command will perform the appropriate ritual or act to create an object (if you have not already created it). Again, this only works after you've successfully followed the instructions at least once.";
    say "[excmd]RESET[/excmd]: Early in the game, you will discover a way to return to the start, while still remembering everything you've learned. Type [excmd]RESET[/excmd] to do this from anywhere in the game. (To restart the entire game and erase all your progress, type [excmd]RESTART COMPLETELY[/excmd].)";
    say line break;
    say "Once you have solved any puzzle successfully, you can solve it again with a single command. For example, the first time you encounter a locked door, you'll have to go find the key and bring it back. But the second time, you can just type [excmd]OPEN DOOR[/excmd]. The game will automatically go to the key, fetch it, return to the door, and unlock it.[para]";
    say "But beware: some puzzles have several solutions. When auto-solving a puzzle, the game picks whichever solution you've used most recently. When you [excmd]PERFORM[/excmd] a ritual, the game follows whichever method you've used most recently. This might matter.[para]";
    say "Finally, don't forget [excmd]CREDITS[/excmd] and [excmd]BACKERS[/excmd][period]";
    instead say "[/parsermsg][br]";
 
Carry out backer-requesting:
    say "[Story title] was launched with the aid of its many Kickstarter patrons. Thank you for your confidence, your support, and your extreme patience.[para]";
    say "(Type [fixed]'CREDITS'[/fixed] for more personal credits and thanks.)[para]";
    [$1000, $250 buckets: 12 names]
    say "[em]Heroes of the Coagulation:[/em] ";
    say "Christopher Cotton, Emily Short, House of Roses, Jason Scott, Jessica Kidd, Justin de Vesine, Kate McKee, Liza Daly, Markus Persson, Mike Drucker, MIT Game Lab, Peter Berger.";
    say line break;
    [$180 bucket: 28 names]
    say "[em]Heroes of the Dissolution:[/em] ";
    say "Adam Cadre, Alexander Shendi, Andrew Schultz, Christoph Winkler, Christopher Armstrong, Collin Pieper, Dan Sanderson, Dan Schmidt, David Van Duzer, Irina Pinjaeva, Jason VandenBerghe, Joe Johnston, John P. Murphy, John Walker Bruce, Josh Lawrence, Juhana Leinonen, Mark Green, Mark Guidarelli, Morgan Schweers, R Allan Baruz, Rich Skrenta, Rob Dubbin, Robert M.R. Cunningham, Russ Bryan, Simon Christiansen, Steven Marsh, anonymous 2.";
    say line break;
    [$100 bucket: 42 names]
    say "[em]Heroes of the Calcination:[/em] ";
    say "[quot]ampersand Eric[quot] Snider, Adam Thornton, Ben Collins-Sussman, Ben Cressey, Brendan Desilets, Carl Muckenhoupt, Chetan, Christos Dimitrakakis, Clara Fernandez-Vara, Craig Smith, Damien Neil, Dan Fabulich, Dan Shiovitz, David William Van Stone, Dr. Bill Racicot, Drew Taylor, Duncan Cross, Evan Stoner, Faisal N. Jawdat, Flourish Klink, Garret, Gerry Deckert, Iain Merrick, Irfon-Kim Ahmad, Jack Welch, John Lunney, Josh S. (grue), Katherine Prevost, Kevin Bruner, Kurt Schaefer, ";
    say "matthew j weaver, Matthew Weise, Michael D. Hilborn, Michael Rubin, Michel Vuijlsteke, Mike Sousa, Nathan Loofbourrow, Nathaniel J Robotnik, Peter Sinkis, Ryan van Barneveld, Sean Murphy, skipclarke.";
    say line break;
    [all the rest: 632 names]
    say "[em]Further heroes:[/em] ";
    say "Aahz, Aaron A. Reed, Adam [']Pi['] Burch, Adam C Leigh, Adam Conover, Admiral Jota, Adrian Hon, Adrien Beau, Adrienne Mueller & James Lawton, AJM, Akilesh Ayyar, Akiva Leffert, Aleksey Linetskiy, aleph_one, Alex Sherratt, Alex Whitington, Alexandre Muñiz, Alexandria Wilkie, Alistair Thomas, Allison Parrish, Anders Hellerup Madsen, Anders Smith, Andre Stenhouse, Andreas Fuchs, Andres Weber, Andrew [quot]Zebranky[quot] Brockert, Andrew [']Zif['] Horton, Andrew Bollen, Andrew Cowper, Andrew Davis, ";
    say "Andrew Hatchell, Andrew Maiman, Andrew Molloy, Andrew Neufeld, Andrew Schepler, Andrew Vestal, Andy Baio, Aneel Nazareth, Angrycoder, Anita Ray, anon, Anthony Molinaro, Anthony Mueller, Araven, Arifa Khursheed, Aris Katsaris, Arleann, Ataraexia, AuldWolf, Austin McDonald, Ava Avane Dawn, Avadista Avasanista Pare Tilefono, Awesomer, baltasarq, Bay Chang, Ben [quot]535[quot] Blank, Benjamin Ragheb, Beth M., Bill Helman, Bill Maya, ";
    say "bj49wd, Bjoern Paschen, blk, Bobby Frye, Brad Gersh, Brad Town, Brett Camper, Brian J Monaghan, Brian Lavelle, Brian Leet, Brian Moriarty, Brice Chidester, Brice Morrison, Britta G, Brittany Gary, Bryant Durrell, Bryce A. Lynch, Byron Alexander Campbell, c.valaas, Cal Henderson, Carl Klutzke, Carl Witty, Carolyn VanEseltine, Casey Kolderup, Catherine Laughlin, Chad Meyer, Chad Parker, Chad Urso McDaniel, Charles Feduke, Charlie Reece, ";
    say "Chris Angelini, Chris Dahlen, Chris Grainger, Chris Patti, Chris Schlarb, Chris Theophilus-Bevis, Christian Bluemke, Christian Gemballa Moura, Christian Sasso, Christina Schulman, Christoph Ender, Christopher K Davis, Christopher Tate, Chromatium, Chrysoula Tzavelas, Cindie Hurley, Cindy Au, Clifton Royston, Cobaltnine, Colin Schatz, Collin Hazlett, Conrad [quot]Lynx[quot] Wong, Cory Brownson, Craig Hulett, Craig Smuda, Croaker, Cynthia Closkey, Dale Newfield, Dan [quot]lerxst[quot] Parsons, Dan Efran, ";
    say "Dan Gee, Dan Martinez, Dan Wineman, Daniel Dresser, Daniel Hengeveld, Daniel M. Drucker, Ph.D., Daniel Ravipinto, Dannel Jurado, Danny Gagne, Daphne Brinkerhoff, Darius Katz, Darius Kazemi, Dark Star, Darren Torpey, Dave LeCompte, Dave Nault, DaveR, David Boyer, David Carlton, David Fletcher, David G Shaw, David Glasser, David Goldfarb, David Inacio, David Kinder, David Rendall, David Silberman, David Young, Deborah Morrison, Deirdre Benson, ";
    say "Dennis G. Jerz, Deterbold, Devil[']s Thumb Productions, Devin Herron, Devon Campbell, Devon Scott-Tunkin, Dietrich Squinkifer, Doc Bo, Dogberry, Don Alsafi, Doug Cuff, Doug Jones, Doug Orleans, Doug Reside, Drew Benedetti, Duell, Dug Steen, Duncan Stevens, Dylan Holmes, Edward Kmett, Edward Osborn, Eli Lee, Elliot B, Elliot Glaysher, Emily Wilson-Orzechowski, Epimetheon, Eric J Leslie, Eric Liga, Erik Loyer, Erik Temple, ";
    say "Erkki Lindpere, Eva Schiffer, Evan Evanson, Evan Paterson, Farmer Sweet-rice, Feneric, Finn McInnes Stokes, frob, g, G. G. Muldoon, G. Hartman, Gabrielle Frame, GabrielR, Gareth Hodges, Gavia Immer, Gavin, Geoff Fortytwo, George Shannon, Georgieanna, Giordano Caputi, Glenn Strong, Glyph, Goob, Gozer Games, Greg Cooksey, Greg Maletic, Gregory Avery-Weir, Guillaume Gautier, Gunther Schmidl, Guy P, ";
    say "Harsimran Khalsa, Henrik Koskinen, Herb Mann, Hestia, Holger Bock Axelsen, Hopping Fun Creations, Ichiro Lambe, Inigo, invariant, Isaac Karth, Isaac Lin, Isaac Schankler, J Earl, Jack Foy, Jacob Sullivan, Jacqueline & Sam Ashwell, James A. English, James Galloway, James Grimmelmann, Jamie Marziano, Jarmo Petäjäaho, Jason Aller, Jason and Kai Wodicka, Jason Catena, Jason Dyer, Jason Fleshman, Jeff Dickerson, Jeff Goldblum, Jeff Gomez, Jeff Guevin, ";
    say "Jens Alfke, Jeremie Lariviere, Jeremy Freese, Jeremy Gans, Jeremy Penner, Jerry Bonner, Jerry Siskind, Jess Higgins, Jesse, Jesse Clark, Jesse McGatha, Jesse McGrew, Jessica Hammer, jfaulken, Jim & Paula Kirk, Jim Crawford, Jim Crocker-Lakness, Jim Troutman, Joe Tortuga, Johan Herrenberg, John Bull, John Dixon, John Doty, John Garnett, John Kua, John Leen, John Payne, John Robinson Wheeler, John Whitlock, Joline Desrosiers, ";
    say "Jon Davidson, Jon Erik Christianson, Jon Peck, Jon Zeppieri, Jonathan Blask, Jonathan Goodwin, Jonathan South, Jonathon Myers, Joonas Sahramaa, Jordan Anderson, Jordi Albornoz Mulligan, Josh Diaz, Josh Fishburn, Josh Thomson, Josh Watzman, Joshua Kronengold, JT Traub, Judson Lester, jukimv1986, Julia Kedge, Justin Butterfield, K Ferguson, K. Adam White, K8 Fitz-Henry, Kal Shaw, Karen Sutula, Karl Ove Hufthammer, Karthik Chikmagalur, Kate Simpson, Katherine Morayati, ";
    say "Kathryn Smuland, Keith Baker, Keith Burt, Ken Gagne, Kes Sampanthar, Kevin, Kevin Colyer, Kevin Jackson-Mead, Kevin Murphy, Kim Riek, Kimberly Beattie, Kirk Davies, Kirt (Loki) Dankmyer, Kiyash Monsef, KMM, Konstantin Augemberg, Krishna [']Shamu['] Sethuraman, Kristan S., Kristyn, Kyle Highful, L.W. Brown, Lachlan Cooper, Laurence Livermore, Lee G, Leland Paul, Leo Breebaart, Lester T. Hobbes, Lise Brodzik, lookmark, lorreen, ";
    say "Lou Sementa, Lucian Smith, Lukas M, Lysithea, M  A, Manolis 13, Marc Moskowitz, Marco Frissen, Mark A-J. Raught, Mark H-J, Mark Musante, Mark Schmelzenbach, Mark Smithson, Mark Terrano, Marshall Quander, Martin Braun, Mathew R Stone, Matt Elder, Matt Fister, Matt Griffin, Matt Kimmel, Matt Parker, Matt Wigdahl, Matthew Callier, Matthew Moskewicz, Matthew Murray, Matthew Ryan, Matthew Sauder, Matthew Wood, Max Battcher, ";
    say "Max Pfennighaus, Megan Good, Melissa Mooney, Melissa Plotkin, Membership of the CMU KGB, Merryl J. Gross, Metoikos, Mia Consalvo, Michael Baltes, Michael C. Martin, Michael Everson, Michael Fessler, Michael Fransioli, Michael Gentry, Michael Kohne, Michael R. Crusoe, Michael Stevenson, Michael Stewart, Michael W. Mattei, Michael Wayne Phipps Jr., Michael Welsh Duggan, Michael Wren, Michel Nizette, Mike Helba, Mike Sugarbaker, Mikhail Ushanov, Mikkel Angaju Rasmussen, Ming Hua, Myles Barros, Nat Lanza, ";
    say "Natalie Romano, Nathan Kelber, Nathan Zalman, Neale Grant, nerakatem, Nevin Steindam, New Orleans Treehouse Project, Nicholas Abboud, Nick, Nick Lowery, Nick Montfort, Nick Novitski, Nikodemus Siivola, Norman Ramsey, Nurse Dragonbreath, Oliver Day, Olna Jenn Smith, OneChordWonder, Oren Ely, Oren Ronen, Ori Avtalion, Ouroboros, Owen Macindoe, Pablo Martínez Merino, pack of chihuahuas, Pam Liu, Pamela Martin, Patrick Winchell, Paul Andinach, Paul Hachmann, ";
    say "Paul Laroquod, Paul O[']Brian, Paul Zagieboylo, Pegana, Perching Path, Peter Berman, Peter Humburg, Peter Landers, Peter Maydell, Peter Rainville, Peter Spicer, Phil, Professor Highland Wolland, pueff, R., R. George Davison, Raf Geens, Raoul Duke, rednikki, Renan Carvalheira, Rich Cheng, Richard Perrin, Rick Reynolds, Rick Sadlowski, Rick Thornquist, Riv, Rob [quot]Flack[quot] O[']Hara, Rob Schultz, Rob Sharp, Robb Sherwin, ";
    say "Robert Hutchinson, Robert Paloutzian, Robert Young, Roberta Bennett, Robin Hunicke, Roger Carbol, Ross Angle, Ross Presser, Royce Odle, rsqrd, Ru, ruthling, Ryan Evans, Rybread Celsius, S. Ben Melhuish, Sam Barlow, Sam Courtney, Sam Marcus, Samuel Cole, Samuel Erikson, Samuel Murphy, Sarah Caplan, Sarinee Achavanuntakul, Satan[']s Little Hamburger Helper, savagerose, Scott Blomquist, Scott Hardwick, Seth M Johnson, Shaun Pryszlak, Shawn Brenneman, ";
    say "Shelby Davis, Shoebox, Sir Garbagetruck, SMAX, Solarisphase, Southall, stack--trace, Stef Maruch, Stefan Dühring, Stefan Llewellyn Smith, Stefan Meier, Stephen Bond, Stephen Gilbert, Stephen Granade, Stephen Kitt, Steve Axthelm, Steve Cook, Steve Evans, Steve G, Steve Leung, Steve McCrea, Steve Mumford, Steven Goldman, Steven McKinney, Steven Zakulec, StJohnLimbo, Storme Winfield, Straeshi, Studio of Electronic Music, Inc., Styger, ";
    say "Sylvia G., Team CWIN, Ten Snakes, therealeasterbunny, Thomas Bøvith, Thomas Drevon, Thomas Lynge, tibbon, Tikitu de Jager, Tim Clemons, Tim Cowley, Tim Furlong, Tim Klein, Tim Rodriguez, Tim Rolands, Tim Seiger, todd paoletti, Tom Tullio, Touchy, Tracy Baker, Travis Fickett, Tristam MacDonald, Tucker McKinnon, Tully Hansen, TwilliK, Vanessa Huxter, Vernon Chee, Ville Lavonius, Vivienne Dunstan, Vyacheslav Dobranov, ";
    say "Watts Martin, Wei-ju Wu, Wesley Osam, Wiley Wiggins, Will Hines, William O[']Neil, Wyatt!, xanna, Xiao Zhuo Jia, Y. K. Lee, Yoon Ha Lee, Yoz Grahame, zabuni, Zack Urlocker, Zed Lopez, zehloani, Zhan Li, anonymous 75.";
 
For constructing the status line:
    status cursor pos 2;
    if the location is the Abstraction Layer:
        say the story title;
    else:
        say location.
 
 
Section - Other Hooks
 
To decide what object is the current toolshop destination:
    decide on the mech-counter.
To decide what room is the current toolshop location:
    decide on the location of the mech-counter.
 
To decide whether alien aither nearby:
    if in Out-Airlock and alien-inner-door is open:
        decide yes.
 
To decide whether nickel-filings-accessible:
    if the nickel-filings is on-stage and Pneuma is fixed:
        decide yes.
 
To decide what ritual-env is debug-override-env: (- (+ bad-env +) -). [This will be ignored.]
 
To skip certain objects for listing in recall:
    [This is called in the OBJECTS command to ensure that spoilery or boring objects are not listed.]
    now the paper-bundle is marked for listing;
    now the counterweight is marked for listing; [no spoilers]
 
The generic-ritual-location is an undescribed ever-done action-goal. The short-description is "reach a ritual bound".
Goal prereqs rule for generic-ritual-location:
    [Some of these zone cases overlap.]
    let G be the current zone;
    if G is mech-lab-zone:
        if Mech-Store is visited:
            require-or-fail the Mech-Store;
            rule succeeds;
    if G is 2nd-lab-zone or G is lab-crawl-zone or G is herbarium-zone or G is chem-lab-zone or G is mech-lab-zone:
        [always visited]
        require-or-fail the 2nd-Lab;
        rule succeeds;
    if G is med-wing-zone:
        if Med-Lab is visited:
            require-or-fail the Med-Lab;
            rule succeeds;
    if G is lab-hall-zone or G is opt-lab-zone:
        if Opt-Store is visited:
            require-or-fail the Opt-Store;
            rule succeeds;
        if Fire-Store is visited:
            require-or-fail the Fire-Store;
            rule succeeds;
        if Mech-Store is visited:
            require-or-fail the Mech-Store;
            rule succeeds;
    if G is fire-lab-zone or G is safe-store-zone:
        if Fire-Store is visited:
            require-or-fail the Fire-Store;
            rule succeeds;
        if Opt-Store is visited:
            require-or-fail the Opt-Store;
            rule succeeds;
        if Mech-Store is visited:
            require-or-fail the Mech-Store;
            rule succeeds;
    if G is 3rd-lab-zone:
        if 3rd-Lab is visited:
            require-or-fail the 3rd-Lab;
            rule succeeds;
    if G is core-hall-zone or G is nave-crawl-zone:
        if Nave is visited:
            require-or-fail the Nave;
            rule succeeds;
    if G is phleg-lab-zone:
        if Phleg-Lab is visited:
            require-or-fail the Phleg-Lab;
            rule succeeds;
    [Should outside zones route to the Nave? I guess so.]
    if always:
        if Nave is visited:
            require-or-fail the Nave;
            rule succeeds;
    if goalstate is not hypothetical:
        say "You're not sure which way the nearest ritual bound is.";
    rule fails.
 
The chymic-ritual-location is an undescribed action-goal. The short-description is "reach the retort".
Goal prereqs rule for chymic-ritual-location:
    require-or-fail the Chem-Lab;
    rule succeeds.
 
The nave-ritual-location is an undescribed action-goal. The short-description is "reach the Nave bound".
Goal prereqs rule for nave-ritual-location:
    require-or-fail the Nave;
    rule succeeds.
 
The chancel-ritual-location is an undescribed action-goal. The short-description is "reach the Chancel bound".
Goal prereqs rule for chancel-ritual-location:
    require-or-fail the Chancel;
    rule succeeds.
 
The aura-imitation-persona-charge is an action-goal. The short-description is "find an officer to imitate".
The aura-imitation-persona-charge has a persona. [The persona of the last (primary) character who we've opened (either) stricture door with. Will be high-ranked if it's not no-persona.]
Understand "a-im-pc" as aura-imitation-persona-charge.
Goal prereqs rule for aura-imitation-persona-charge:
    [Select the known character matching the last known persona that worked. If location of avatar is not known, fail. If the avatar turns out not to be there, fail.]
    unless a quartz-or-jade inscribable (called ET) symbol-matches imitation-symbol:
        say "(BUG) in aura-imitation-persona-charge, but no ET!";
        rule fails;
    if the persona of ET is not no-persona:
        [Already charged.]
        if goalstate is not hypothetical:
            say "[The ET] is already imitating [persona of ET].";
        rule succeeds;
    let P be the persona of aura-imitation-persona-charge;
    if P is no-persona:
        if goalstate is not hypothetical:
            say "You're not sure which officer to imitate with [the ET].";
        rule fails;
    let MC be the mem-character associated with P;
    if MC is nothing:
        say "(BUG) in aura-imitation-persona-charge, but [P] has no mem-character!";
        rule fails;
    let R be the last-met-room of MC;
    if R is-room off-stagey:
        if goalstate is not hypothetical:
            say "You don't know where [the MC] is.";
        rule fails;
    let C be the last-met-avatar of MC;
    require-or-fail R;
    if C is nothing or C is no-thing or C is not in R:
        if goalstate is not hypothetical:
            say "When you arrive, however, [the MC] is gone.";
        rule fails;
    if goalstate is not hypothetical:
        now the persona of ET is the persona of C;
        say "You touch [the ET] to [the C].";
    rule succeeds.
 
Chapter - Various Game Things
 
Section - Library Customizations
 
A thing can be discovered or undiscovered. A thing is usually undiscovered. [Usually not resettable. The meaning is ad-hoc by object.]
 
To say discover-me:
    now the item described is discovered.
To say discover (T - thing):
    now T is discovered.
 
A door has a room called the pull-side. The pull-side of a door is usually nothing.
 
Check pulling a door when the pull-side of the noun is-not-room off-stagey:
    if the location is the pull-side of the noun:
        instead try opening the noun;
    else:
        instead try closing the noun.
 
Check pushing a door when the pull-side of the noun is-not-room off-stagey:
    if the location is the pull-side of the noun:
        instead try closing the noun;
    else:
        instead try opening the noun.
 
 
Section - Cyclers
 
A cycler is a kind of object.
A stopping-cycler is a kind of cycler.
A cycler has a number called the current-count. The current-count of a cycler is usually 1.
A cycler has a number called the limit. The limit of a cycler is usually 2.
[Resettable? Not unless we need it.]
 
To decide what number is peek at (C - cycler):
    decide on the current-count of C.
 
To decide what number is current (C - cycler):
    let N be the current-count of C;
    increase the current-count of C by one;
    if the current-count of C is greater than the limit of C:
        now the current-count of C is one;
    decide on N.
 
To decide what number is current (C - stopping-cycler):
    let N be the current-count of C;
    increase the current-count of C by one;
    if the current-count of C is greater than the limit of C:
        now the current-count of C is the limit of C;
    decide on N.
 
To decide what number is peek at (C - cycler):
    decide on the current-count of C.
 
 
Section - Miscellaneous Classes
 
The lamps-backdrop is a scenery plural-named backdrop. The printed name is "lamps".
Understand "lamp", "lamps", "lantern", "lanterns", "disc", "discs", "disk", "disks", "sophic", "ivory" as the lamps-backdrop.
 
The description of the lamps-backdrop is "Sophic lanterns are set high on the walls, as they are throughout the marcher. They're ivory disks, engraved with runes to draw phlogiston from Pneuma and disperse it as light[lamps-gloss]."
 
To say lamps-gloss:
    if Pneuma is not fixed:
        say ".[para]Something is wrong with the lanterns, however. Their light is weak and unsteady; the marcher has become a place of dim shadows";
    else:
        say ". Now that the dragon is awake, the lanterns burn with a steady cool glow".
 
The lens-view of the lamps-backdrop is "Pneuma[if Pneuma is not fixed], though it is weak[end if]".
 
Check examining the lamps-backdrop when the atmosphere of the location is water-atm:
    instead say "Sophic lanterns glow [if Pneuma is not fixed]fitfully[else]steadily[end if] through the murk."
 
Check examining the lamps-backdrop when the location is low-ceilinged:
    instead say "Sophic lanterns are set into the low ceiling[lamps-gloss]."
 
Check examining the lamps-backdrop when the zone of the location is basement-zone:
    say "Sophic lanterns are bolted to the natural stone above you";
    if Pneuma is not fixed:
        say ".[para]These deep regions are poorly lit at the best of times. Now the flickering lamps barely illuminate the stone at your feet";
    else:
        say ". The lanterns burn with a steady cool glow, but they're still only fireflies in the deep dark";
    instead say "."
 
Check touching the lamps-backdrop:
    instead say "There's no reason to mess with the sophic lamps[if Pneuma is not fixed]. Something may be wrong with Pneuma, but you can't fix it from here[end if]."
 
Check taking the lamps-backdrop:
    instead try touching the lamps-backdrop.
Check pushing the lamps-backdrop:
    instead try touching the lamps-backdrop.
Check pulling the lamps-backdrop:
    instead try touching the lamps-backdrop.
Check tapping something on the lamps-backdrop:
    instead try touching the lamps-backdrop.
 
Check rubbing the lamps-backdrop:
    instead say "The lanterns aren't dirty."
 
Check smelling the lamps-backdrop:
    instead say "Sophic lanterns are odorless. Easy to clean, too, as you know from some tedious work shifts."
 
Check inspecting the lamps-backdrop with the oculus:
    instead say "Through the oculus, you can see the [if Pneuma is fixed]steady[else]unsteady[end if] flow of phlogiston through the lanterns."
 
A room can be low-ceilinged.
 
A room can be lamp-enabled. A room is usually lamp-enabled.
The Abstraction Layer is not lamp-enabled.
When play begins (this is the lamps-backdrop setup rule):
    move the lamps-backdrop backdrop to all lamp-enabled rooms.
 
 
The wallpaper-backdrop is a scenery backdrop. The printed name is "wallpaper".
Understand "rough", "scruffy", "wall" as the wallpaper-backdrop.
Understand "stripes", "cogwork" as the wallpaper-backdrop.
 
Check searching the wallpaper-backdrop:
    instead try examining the wallpaper-backdrop.
 
Check examining the wallpaper-backdrop:
    if the location is Lab-Hall-NW and hall-script is in the location:
        instead say "Black marks are scrawled across the wallpaper here.";
    if the location is East-Side-Hall or the location is West-Side-Hall or the location is Med-Wing-Hall:
        instead say "The wallpaper sports an abstract cogwork pattern.";
    if the location is the Under-Hall or the location is the Quarters-Hall or the location is the Officer-Hall:
        instead say "The wallpaper is decorated in fish. You've never had the nerve to ask who ordered that.";
    instead say "The wallpaper has a faded pattern of blue stripes. It's boring, but it's home."
 
Check reading the wallpaper-backdrop when an alien-script (called T) is in the location:
    instead try examining T.
 
Check taking the wallpaper-backdrop:
    instead say "You're not bored enough to peel wallpaper."
 
Check touching the wallpaper-backdrop:
    if the location is Lab-Hall-NW and hall-script is in the location:
        instead try touching the hall-script.
 
Check rubbing the wallpaper-backdrop:
    if the location is Lab-Hall-NW and hall-script is in the location:
        instead try rubbing the hall-script.
 
A room can be wallpaper-enabled.
When play begins (this is the wallpaper-backdrop setup rule):
    move the wallpaper-backdrop backdrop to all wallpaper-enabled rooms.
 
 
A fracture is a kind of thing. A fracture is usually scenery. The printed name of a fracture is usually "fracture".
Understand "fracture", "warped", "crack", "cracked", "plane", "cleavage" as a fracture.
 
The description of a fracture is usually "Like the other fractures you've found, this looks like a faintly-distorting crack in the air."
 
The lens-view of a fracture is usually "the Higher Spheres".
 
Check rubbing a fracture:
    instead try touching the noun.
Check pushing a fracture:
    instead try touching the noun.
Check pulling a fracture:
    instead try touching the noun.
Check turning a fracture:
    instead try touching the noun.
Check attacking a fracture:
    instead try touching the noun.
 
Check touching a fracture:
    instead say "The fracture feels like slick, hard air."
 
Check taking a fracture:
    instead say "The fracture cannot be moved."
 
Check entering a fracture:
    instead say "You try to push through the fracture, but the surface is impenetrable."
 
Check repairing a fracture:
    instead say "The question is, how."
 
Check tasting a fracture:
    instead say "The fracture is as tasteless as glass."
 
Check smelling a fracture:
    instead say "The fracture is odorless."
 
Check inserting anything into a fracture:
    if the noun is a metallic chime and the ring-time of the noun is not zero:
        instead try tapping the noun on the second noun;
    instead say "The fracture is impenetrable."
 
Check inspecting a fracture with the oculus:
    instead say "Through the oculus, the fracture looks like... a fracture. Pieces of space, of the marcher, that do not connect as they should."
 
Check putting a metallic chime on a fracture when the ring-time of the noun is not zero:
    instead try tapping the noun on the second noun;
 
Check tapping the F-sharp-chime on a fracture when the ring-time of the F-sharp-chime is not zero:
    [permeability or decoherence]
    now the ring-time of the F-sharp-chime is zero;
    instead say "You press the chime against [the second noun], but the vibration mutes and dies. It may look like glass, but it's obviously something much stranger."
 
Check tapping a quartz-or-jade on a fracture (called T) when the noun is inscribed and a fracture-blocked character (called C) is in the location:
    instead say "You press [the noun] against [the T], as close as you can manage to [the C]. Nothing happens, however. Apparently direct physical contact is necessary, and the fracture makes that impossible."
 
A crawl-hatch is a kind of door.
The printed name of a crawl-hatch is usually "iron panel".
A crawl-hatch can be clean or dirty. A crawl-hatch is usually clean.
A crawl-hatch is usually scenery.
A crawl-hatch is usually metallic.
The lens-view of a crawl-hatch is usually "Mars".
The description of a crawl-hatch is usually "An iron hatch."
 
Understand "flat", "iron", "panel", "service", "hatch", "steel", "bolts", "bolted" as a crawl-hatch.
Understand "rust", "rusty" as a crawl-hatch when the item described is dirty.
 
Check examining a crawl-hatch:
    let dir be the direction of the noun from the location;
    say "It's just another service hatch in the [if dir is up]ceiling[else]floor";
    if the noun is closed:
        say ". The panel is closed";
    else:
        say ". The panel is open, but you can't see much on the other side";
    instead say "."
 
Check opening a dirty crawl-hatch:
    instead say "The hatch is rusted in place."
 
Report opening a crawl-hatch:
    let dir be the direction of the noun from the location;
    instead say "You [if dir is down]lever[else]push[end if] the iron panel open."
 
Report closing a crawl-hatch:
    let dir be the direction of the noun from the location;
    instead say "You [if dir is down]push[else]pull[end if] the hatch closed, although you don't bother bolting it."
 
Check locking a not lockable crawl-hatch with:
    instead say "The service hatch is secured with bolts, not with a lock."
 
Check unlocking a not lockable crawl-hatch with:
    instead say "The service hatch is secured with bolts, not with a lock."
 
Check searching a crawl-hatch:
    if the noun is closed:
        instead say "The panel isn't open.";
    instead say "The panel is open, but you can't see much on the other side."
 
Check climbing a crawl-hatch:
    instead try entering the noun.
 
Check turning a crawl-hatch:
    instead try opening the noun.
 
Check pushing a crawl-hatch when the pull-side of the noun is not nothing:
    [override the usual push-pull mechanics, to polish the initial room]
    instead try opening the noun.
 
Check taking a closed crawl-hatch:
    instead try opening the noun.
 
Check rubbing a crawl-hatch when the noun is dirty:
    instead say "The bolts on the panel are way past the point of a casual scrubbing."
 
Check inserting something into an open crawl-hatch:
    instead say "Flinging things through open hatches would be messy."
 
Check tapping the steel-bolt on a crawl-hatch when the symbol-type of the steel-bolt is some-saturation-symbol:
    say "You carefully lay the [symbol-type of the noun] symbol against [the second noun]";
    uninscribe the steel-bolt;
    instead say ". The symbol discharges, but the hatch doesn't get any cleaner."
 
 
A syn-gap-door is a kind of container.
A syn-gap-door is usually openable. A syn-gap-door is usually scenery.
A syn-gap-door has a thing called the examine-target.
A syn-gap-door has some text called the refer-name. The refer-name of a syn-gap-door is usually "(BUG) [item described]".
Understand "open", "opened" as a syn-gap-door when the item described is open.
Understand "closed" as a syn-gap-door when the item described is closed.
 
Check examining a syn-gap-door:
    if the noun is closed:
        instead say "[The noun] is closed.";
    instead try examining the examine-target of the noun.
 
Check searching a syn-gap-door:
    instead try examining the noun.
 
Check entering a syn-gap-door:
    if the noun is closed:
        instead try opening the noun;
    instead say "The fracture blocks [the noun]."
 
Check listening to a syn-gap-door:
    instead say "You hear nothing at all."
 
Check inserting something into a syn-gap-door when the second noun is open:
    instead say "The landscape is sealed away by that fracture.";
 
Check getting off a syn-gap-door:
    instead try entering the noun.
 
Check pulling a syn-gap-door:
    instead try opening the noun.
 
Check pushing a syn-gap-door:
    instead try closing the noun.
 
 
A syn-bridge-door is a kind of door.
A syn-bridge-door is usually open. A syn-bridge-door is usually scenery.
 
Check closing a syn-bridge-door:
    say "[The noun] does not move at all, no matter how hard you";
    if the pull-side of the noun is-room off-stagey:
        say " yank";
    else if the pull-side of the noun is the location:
        say " push";
    else:
        say " pull";
    instead say "."
 
A standard-cabinet is a kind of container.
A standard-cabinet is usually openable. A standard-cabinet is usually metallic. A standard-cabinet is usually scenery.
A standard-cabinet has an action-goal called the opening-goal. The opening-goal of a standard-cabinet is usually impossible-goal.
The printed name of a standard-cabinet is usually "cabinet".
Understand "alloy", "cabinet" as a standard-cabinet.
Understand "locked", "sealed" as a standard-cabinet when the item described is locked.
Understand "open", "opened" as a standard-cabinet when the item described is open.
Understand "closed" as a standard-cabinet when the item described is closed.
 
Check searching a standard-cabinet:
    instead try examining the noun.
 
Check taking a standard-cabinet:
    instead say "[The noun] is solidly fastened to the wall."
 
Check pulling a standard-cabinet:
    instead try opening the noun.
 
Check freeing a standard-cabinet:
    instead try opening the noun.
 
Magnetization rule when the item described is in a standard-cabinet (called T):
    if T is closed:
        say "Something rattles around inside [the T].";
        rule fails;
    else:
        say "[The item described] vibrates in response, and bounces out of [the T] into your hand.";
        rule succeeds.
 
 
A bunk is a kind of supporter.
The printed name of a bunk is usually "bunk".
A bunk is usually scenery.
Understand "bed", "bunk" as a bunk.
 
Check entering a bunk:
    instead say "You're not tired, and [if the noun is not plural-named]this isn't your bunk[else]these aren't your bunks[end if]."
 
 
A paper-scenery is a kind of thing. Paper-scenery is usually scenery.
 
Check cutting paper-scenery:
    instead say "The paper garden is a symbolic nexus of the [Retort]. Tearing it up would be disastrous. More disastrous. Bad, anyway."
Check smashing paper-scenery:
    instead try cutting the noun.
 
Check taking paper-scenery:
    instead try cutting the noun.
 
Check igniting paper-scenery with something:
    instead say "Burning down the garden would be disastrous. Burning down the garden while you're in it would be disastrous and stupid."
 
 
A chasm-section is a kind of thing.
A chasm-section is usually scenery.
The printed name of a chasm-section is usually "chasm".
The description of a chasm-section is usually "The chasm runs alongside this path, directly to the west. Its depths are unfathomable."
Understand "chasm", "abyss", "pit", "canyon", "depths" as a chasm-section.
 
Check searching a chasm-section:
    instead say "You see nothing below but the waiting dark."
 
Check taking a chasm-section:
    instead say "If not careful, chasm get [em]you[/em]."
 
Check throwing something at a chasm-section:
    instead try inserting the noun into the second noun.
 
The drop-stuff-in-chasm-section rule is listed after the better can't insert what's not held rule in the check inserting it into rulebook.
Check inserting a takeable thing into a chasm-section (this is the drop-stuff-in-chasm-section rule):
    say "You fling [the noun] into the chasm";
    if the noun is alight:
        say ". Its light falls away from you, dwindles, and is gone";
    else:
        say ". It vanishes without a sound";
    retire the noun by chasm-plummeting;
    instead say "."
 
Check entering a chasm-section:
    say "Can't be any worse than some of the places you've been... You step forward and drop away from the world.";
    now the player is in the Chasm-Void-Room;
    stop the action.
 
 
An alien-script is a kind of thing.
Alien-script is usually scenery. Alien-script is usually readable. Alien-script is usually plural-named.
The printed name of alien-script is usually "alien markings".
Understand "twisting", "twisted", "involuted", "illegible", "stroke", "strokes", "lines", "marks", "markings", "black", "alien", "script", "graffiti", "graffito" as alien-script.
 
Check taking alien-script:
    instead say "They're markings on the wall. You can't pick them up."
 
Check touching alien-script:
    instead say "You can feel no texture of ink or paint on the black lines."
 
Check rubbing alien-script:
    instead say "The black lines do not smear or fade, no matter how hard you rub them."
 
Check tapping the dispersal-brush on alien-script:
    retire the dispersal-brush by manual destruction in the second noun;
    instead say "The moment the feather touches the markings, it crackles and falls to dust. Whoops. The markings are entirely unaffected."
 
Check putting the dispersal-brush on alien-script:
    instead try tapping the dispersal-brush on the second noun.
 
Check inspecting an alien-script with the planetary-lens:
    instead say "When viewed through the planetary lens, the black marks are blurred and indistinct."
 
Check inspecting an alien-script with the oculus:
    if script-legible:
        instead say "When viewed through the oculus, the black marks are clearly associated with the wreck you discovered.";
    instead say "The symbolic associations of the black marks are as unfamiliar as the script itself."
 
To say alien-script-understanding about (subject - text):
    say ".[para]You stare at the black script. It's definitely [em]familiar[/em] now; something like an echo in the back of your mind";
    say ". It's something about [subject]...[para][one of]Comprehension blasts you. You gasp and clutch at your head, but the pain is entirely metaphorical, a shift of context worse than any headache[ellipsis][or]The pain of comprehension is less severe now, but it still nearly drives you to your knees[period][stopping]"
 
Alien-glyph-item is a kind of thing.
Alien-glyph-item is usually scenery. Alien-glyph-item is usually readable.
An alien-glyph-item has a formula called the glyph-used.
The printed name of an alien-glyph-item is usually "alien glyph".
[The description is the wallop-message.]
Understand "alien", "glyph", "black", "knot", "tangle", "mark", "marking", "marks", "markings", "stroke", "strokes", "script" as an alien-glyph-item.
 
Check taking an alien-glyph-item:
    instead say "The knot is a black mark on metal, not something you can hold in your hand."
 
Check inspecting an alien-glyph-item with the planetary-lens:
    instead say "When viewed through the planetary lens, the glyph is blurred and indistinct."
 
Check inspecting an alien-glyph-item with the oculus:
    instead say "When viewed through the oculus, the glyph seems somehow related to dragon control theory."
 
Check touching an alien-glyph-item:
    instead say "You run your fingers over the black knot, but it has no texture of ink or paint."
Check rubbing an alien-glyph-item:
    instead try touching the noun.
 
Check examining an alien-glyph-item:
    let G be the glyph-used of the noun;
    if G is not an alien-glyph:
        instead say "(BUG) [The noun] refers to [G].";
    if G is known:
        say "(BUG) [The noun] refers to [G], already known.";
    mark G as known;
    now the noun is off-stage;
    set pronouns from G;
    instead say "[description of the noun][line break]".
 
Section - Recalling Doors
 
A door has some text called the refer-name. The refer-name of a door is usually "".
 
Carry out recalling-doors (this is the recalling-doors rule):
    say "You have yet to deal with the following locked doors and barriers:[br]";
    if syn-gap-doors-fixed is false:
        repeat with O running through ever-seen syn-gap-doors:
            say "[indentation 2]the [refer-name of O][br]";
    [Pre-syn fake doors in hallway are not listed, because the syn-gap-doors are.]
    repeat with O running through ever-seen doors:
        if the refer-name of O is not "":
            if O is a syn-bridge-door:
                if O is the real-door-SE or O is the real-door-SW:
                    [These doors can never be un-dealt-with.]
                    continue the loop;
                if O is the real-opt-door and the Opt-Closet is visited:
                    continue the loop;
                if O is the real-arms-door and the Arms-Quarters is visited:
                    continue the loop;
                say "[indentation 2]the [refer-name of O][br]";
                continue the loop;
            [Ordinary doors.]
            let G be the opening-goal of O;
            if G is impossible-goal:
                [A couple of doors are blocked even though they have no opening-goals. I can't remember why.]
                if O is:
                    -- the bird-door: now G is g-bird-door;
                    -- the med-wing-door: now G is g-in-med-wing;
                    -- the ante-door: now G is g-ante-door;
                    -- the a-window: now G is the g-alien-window;
                    -- the porti-main-doors:
                        [never open, always listed]
                        say "[indentation 2]the [refer-name of O][br]";
                        continue the loop;
            if G is impossible-goal:
                say "(BUG impossible door [O])[br]";
            if G is ever-done:
                continue the loop;
            say "[indentation 2]the [refer-name of O][br]";
    [We omit windows, reset-doors, and open archways and gaps. But include the alien window.]
    if the out-inferno is ever-seen:
        if g-charred-hall is not ever-done:
            say "[indentation 2]the inferno in the Burning Hall[br]";
    if the bridge-ladder is ever-seen:
        if g-bridge-ladder is not ever-done:
            say "[indentation 2]the Observatory ladder[br]";
    if the bridge-end-west is ever-seen:
        if the Chasm-Bridge is not visited:
            say "[indentation 2]the South Chasm bridge[br]";
    if the Maze-Crawl is visited:
        if g-baros-crawl is not ever-done:
            say "[indentation 2]the Garden Maze crawlway[br]";
    if the Baros-Crawl is visited:
        if g-baros-crawl is not ever-done:
            say "[indentation 2]the Barosy crawlway[br]";
    if the Out-Chamber is visited:
        if aither-survival-goal is not ever-done:
            say "[indentation 2]the alien wreck interior[br]";
    repeat with O running through ever-seen standard-cabinets:
        let G be the opening-goal of O;
        if G is impossible-goal:
            say "(BUG impossible cabinet in [location of O])[br]";
        if G is ever-done:
            continue the loop;
        say "[indentation 2]the [location of O] cabinet[br]";
    if the store-safe is ever-seen:
        if g-store-safe is not ever-done:
            say "[indentation 2]the [location of store-safe] safe[br]";
    let N be the number of ever-seen fractures;
    if N is greater than one:
        say "[indentation 2][N in words] fractures[br]";
 
 
Section - Ad Hoc Env Influence
 
The ash is a takeable-thing. The printed name is "pinch of ash".
The description is "It's a pinch of unremarkable grey ash."
The lens-view is "the Earth, faintly".
Understand "pinch", "pinch of", "grey", "gray", "ashes" as the ash.
 
Check smelling the ash:
    instead say "It smells burnt."
Check tasting the ash:
    instead say "It tastes like ash."
 
The grey-dust is a takeable-thing. The printed name is "pinch of Hadean dust".
The description is "It's a pinch of grey dust -- unremarkable, if you didn't know its origin."
The lens-view is "a Hadean land".
Understand "pinch", "pinch of", "hadean", "grey", "gray", "dust" as the grey-dust.
 
Check smelling the grey-dust:
    instead say "The dust has a gunpowdery aroma."
Check tasting the grey-dust:
    instead say "It tastes like sharp dust."
 
The brass-coin is a metallic symbolish takeable-thing. The printed name is "brass coin".
The description is "This is a cheap brass coin -- old, but not an antique. It looks like someone picked it up in a junk shop, which is probably exactly what happened. One face is stamped with a rayed sun, which makes it a handy symbolic token."
The lens-view is "the Sun".
The brass-coin has a descriptor-type. The descriptor-type of the brass-coin is brass-descriptor. [for use in clock tincture]
Understand "brass", "cheap", "coin", "rayed", "sun" as the brass-coin.
Understand "coins" as the plural of brass-coin.
 
Check turning the brass-coin:
    if the player is not carrying the brass-coin:
        instead say "You're not holding [the noun].";
    instead say "You toss the coin idly[one of]. Heads[or]. Tails[purely at random]."
 
Check tapping the brass-pin on the brass-coin when the symbol-type of the brass-pin is some-saturation-symbol:
    say "You carefully lay the [symbol-type of the brass-pin] symbol against the brass coin";
    uninscribe the brass-pin;
    instead say ". The symbol discharges with a faint pop. The coin gets a bit cleaner."
 
The silver-coin is a metallic symbolish takeable-thing. The printed name is "silver coin".
The description is "It's a worn silver coin. One side is stamped with a crude grinning moon-face. The other seems to be a fish."
The lens-view is "the Moon".
Understand "silver", "worn", "coin", "moon", "fish" as the silver-coin.
Understand "coins" as the plural of silver-coin.
 
Check turning the silver-coin:
    if the player is not carrying the silver-coin:
        instead say "You're not holding [the noun].";
    instead say "You toss the coin idly[one of]. Heads[or]. Fish[purely at random]."
 
The horn-coin is a symbolish takeable-thing. The printed name is "horn coin".
The description is "It's a coin, crudely carved of animal horn. The symbol of an anchor is cut into one face."
The lens-view is "Saturn".
Understand "horn", "animal", "crude", "coin", "anchor" as the horn-coin.
Understand "coins" as the plural of horn-coin.
 
Check turning the horn-coin:
    if the player is not carrying the horn-coin:
        instead say "You're not holding [the noun].";
    instead say "You toss the coin idly[one of]. The anchor turns up[or]. The anchor doesn't turn up[purely at random]."
 
The measuring-block is a metallic symbolish readable takeable-thing. The printed name is "measuring block".
The description is "It's a tiny brass measuring block, meant for a balance scale. The number '27' is engraved on one face, along with a mark certifying precision."
The lens-view is "Venus and Ganymede".
The measuring-block has a descriptor-type. The descriptor-type of the measuring-block is brass-descriptor. [for use in clock tincture]
Understand "brass", "block", "cube", "scale", "tiny", "small", "27" as the measuring-block.
 
Check tapping the brass-pin on the measuring-block when the symbol-type of the brass-pin is some-saturation-symbol:
    say "You carefully lay the [symbol-type of the brass-pin] symbol against the brass block";
    uninscribe the brass-pin;
    instead say ". The symbol discharges with a faint pop. The block gets a bit cleaner."
 
The ivory-bead is a takeable-thing. The printed name is "ivory bead".
The description is "The bead is ivory, rather larger than your thumbnail, carved in pleasingly abstract swirls. You've seen them used for meditation or just thumb-fiddling; they're supposed to represent spiritual calm. At least according to the knickknack shop owners who sell them."
The lens-view is "the heavens".
Understand "ivory", "bead", "pale", "yellow" as the ivory-bead.
Understand "clutter" as the ivory-bead when the ivory-bead is not handled.
 
Check rubbing the ivory-bead:
    instead say "You rub the ivory with your thumb, and feel marginally more spiritual."
 
The tao-amulet is a symbolish takeable-thing. The printed name is "Chinese amulet".
The description is "The amulet is a small ribbon of ricepaper, painted with I Ching trigrams in the Oriental tradition. (The Empire is even-handedly syncretic -- it steals from everybody -- and the Navy uses these amulets to set up rituals of Chinese derivation.)"
The lens-view is "the heavens, in an Oriental motif".
Understand "chinese", "i", "ching", "amulet", "rice", "ricepaper", "rice-paper", "rice paper", "ribbon" as the tao-amulet.
 
Check reading the tao-amulet:
    instead say "The symbols on the amulet are just groups of three lines each. You know they have meanings in the I Ching tradition, but you've never memorized them. Maybe you should have."
 
Check turning the tao-amulet:
    if the player is not carrying the tao-amulet:
        instead say "You're not holding [the noun].";
    let L be "[one of]straight[or]broken[purely at random]";
    instead say "You flick the amulet through your fingers. You get the trigram [L]-[L]-[L], for all the good that does you."
 
Check waving the tao-amulet:
    instead try turning the tao-amulet.
 
Check eating the tao-amulet:
    instead say "Ricepaper isn't as edible as it sounds."
 
Rule for enkilning the tao-amulet:
    say "The ricepaper burns instantly.";
    rule fails.
 
Rule for incinerating the tao-amulet:
    burn subject.
 
The infotater is a readable symbolish takeable-thing. The printed name is "rotor card".
Understand "infotator", "rotor", "card", "cardboard", "envelope", "spinner", "hole" as the infotater.
 
A weather-symbol is a kind of value. The weather-symbols are snowy-day, windy-day, sunny-day, rainbow-day, moonlit-night.
Understand "snow", "snowy" as snowy-day.
Understand "wind", "windy", "blustery" as windy-day.
Understand "sun", "sunny" as sunny-day.
Understand "rainbow" as rainbow-day.
Understand "moonlit", "moon", "night", "moonlit night" as moonlit-night.
To say (W - weather-symbol):
    if W is:
        -- snowy-day: say "snowy day";
        -- windy-day: say "windy day";
        -- sunny-day: say "sunny day";
        -- rainbow-day: say "rainbow";
        -- moonlit-night: say "moonlit night";
 
The infotater has a weather-symbol.
 
The description of the infotater is "This is a handy device for setting various environmental influences. It's a sort of cardboard envelope with a spinner inside and a little hole cut out. You can turn it so that one of five symbols shows through -- currently, a sketch of a [weather-symbol of the infotater]."
 
Check searching the infotater:
    instead say "The rotor card is set to a sketch of [weather-symbol of the infotater]."
 
Check inspecting the infotater with the planetary-lens:
    say "When viewed through the planetary lens, the rotor card resembles";
    if the weather-symbol of the infotater is:
        -- snowy-day: say " an Erebian land";
        -- windy-day: say " an Aeolian land";
        -- sunny-day: say " a Helian land";
        -- rainbow-day: say " a Hermetic land. Which is strange, since they're mythical";
        -- moonlit-night: say " a Hadean land";
    instead say "."
 
Check opening the infotater:
    instead say "Tearing open the rotor card would ruin it."
 
Check turning the infotater:
    let W be the weather-symbol after the weather-symbol of the infotater;
    now the weather-symbol of the infotater is W;
    instead say "You turn the rotor until it shows a [weather-symbol of the infotater]."
 
Check setting the infotater to:
    let snip be the topic understood with the word day chopped off;
    unless snip matches "[weather-symbol]":
        instead say "The rotor card has no such setting.";
    let W be the weather-symbol understood;
    if the weather-symbol of the infotater is W:
        instead say "The rotor already shows the [weather-symbol of the infotater].";
    now the weather-symbol of the infotater is W;
    instead say "You turn the rotor until the [weather-symbol of the infotater] is visible."
 
Rule for enkilning the infotater:
    say "The cardboard catches fire quickly and burns up.";
    rule fails.
 
Rule for incinerating the infotater:
    burn subject.
 
To decide what snippet is (snip - snippet) with the word day chopped off: (- SnippetWithDayChoppedOff({snip}) -).
 
Include (-
[ SnippetWithDayChoppedOff snip   wstart wlen;
    wstart = snip / 100;
    wlen = snip % 100;
    if (wlen >= 2) {
        if (WordFrom(wstart+wlen-1, parse) == 'day') {
            wlen--;
            snip = (wstart*100) + wlen;
        }
    }
    return snip;
];
-).
 
Section - Combination Locks
 
A lock-symbol is a kind of value.
 
No-lock-symbol is a lock-symbol.
 
[Checkfunc should take a lock-symbol and return -1 (not in combo), -2 (not on lock at all), or the index of the given symbol in the lock's combo (0 to N-1). As a special case, when given no-lock-symbol, it should return the length N of the combo. I am not proud of this.]
To decide whether (snip - snippet) unlocks (T - thing) via (checkfunc - phrase lock-symbol -> number):
    let snip-start be the start of snip;
    let snip-len be the length of snip;
    let N be snip-start;
    let matched be zero;
    while N is less than (snip-start + snip-len):
        let newsnip be the snippet starting at N with length 1;
        if word N of the buffer is comma-like:
            increment N;
            continue the loop;
        unless newsnip matches "[lock-symbol]":
            if matched is not zero:
                say ".[para]";
            refuse the combination for T with newsnip and no-lock-symbol and whether or not newsnip matches "[number]";
            decide no;
        let L be the lock-symbol understood;
        if L is no-lock-symbol:
            if matched is not zero:
                say ".[para]";
            say "I don't even know what that means.";
            decide no;
        let pos be checkfunc applied to L;
        if pos is -2:
            if matched is not zero:
                say ".[para]";
            refuse the combination for T with newsnip and L and false;
            decide no;
        if matched is zero:
            say "You set the lock to";
        else:
            say ", then";
        say " [L]";
        increment matched;
        if the lock-counter of T is pos:
            increment the lock-counter of T;
            let max be checkfunc applied to no-lock-symbol;
            if the lock-counter of T is max:
                say ".[para]";
                now the lock-counter of T is zero;
                decide yes;
        else:
            now the lock-counter of T is zero;
            if pos is zero:
                increment the lock-counter of T;
        increment N;
    if matched is zero:
        say "You'll have to say what you want to set it to.";
        decide no;
    say ".";
    decide no.
 
To decide whether (snip - snippet) completes the calculator combination:
    let the initial score be the calculator correct score;
    let snip-start be the start of snip;
    let snip-len be the length of snip;
    let N be snip-start;
    let matched be zero;
    while N is less than (snip-start + snip-len):
        let newsnip be the snippet starting at N with length 1;
        if word N of the buffer is comma-like:
            increment N;
            continue the loop;
        unless newsnip matches "[lock-symbol]":
            if matched is not zero:
                say ".[para]";
            refuse the combination for the calc-dial with newsnip and no-lock-symbol and whether or not newsnip matches "[number]";
            decide no;
        let L be the lock-symbol understood;
        if L is no-lock-symbol:
            if matched is not zero:
                say ".[para]";
            say "I don't even know what that means.";
            decide no;
        if L is not a greek-symbol:
            if matched is not zero:
                say ".[para]";
            refuse the combination for the calc-dial with newsnip and L and false;
            decide no;
        let pos be the lock-counter of the calculator;
        set the calculator symbol pos to L;
        if matched is zero:
            say "You turn the dial, and the [pos + 1 in wordsth] sphere revolves to [L]";
        else if matched is one:
            say ", then the [pos + 1 in wordsth] to [L]";
        else:
            say ", the [pos + 1 in wordsth] to [L]";
        increment matched;
        increment the lock-counter of the calculator;
        if the lock-counter of the calculator is the calculator combo length:
            say ".[para]";
            now the lock-counter of the calculator is zero;
            decide yes;
        increment N;
    if matched is zero:
        say "You'll have to say what you want to set it to.";
        decide no;
    say ".[para]The spheres";
    if the initial score is not calculator combo length:
        say " still look completely wrong";
    else:
        say " are misaligned again";
    say ".";
    decide no.
 
To refuse the combination for (T - thing) with (newsnip - snippet) and (L - lock-symbol) and (isnumber - truth state):
    if newsnip matches "[number]":
        say "The lock does not show numbers.";
    else:
        say "The lock has no '[newsnip]' setting."
 
Sun-ls is a lock-symbol.
Understand "sun", "sol", "helios" as Sun-ls.
 
Mercury-ls is a lock-symbol.
Understand "mercury", "hermes" as Mercury-ls.
 
Venus-ls is a lock-symbol.
Understand "venus", "aphrodite" as Venus-ls.
 
Earth-ls is a lock-symbol.
Understand "earth", "gaia" as Earth-ls.
 
Luna-ls is a lock-symbol.
Understand "luna", "moon", "diana" as Luna-ls.
 
Mars-ls is a lock-symbol.
Understand "mars", "ares" as Mars-ls.
 
Jupiter-ls is a lock-symbol.
Understand "jupiter", "jove", "zeus "as Jupiter-ls.
 
Saturn-ls is a lock-symbol.
Understand "saturn", "cronus", "kronos" as Saturn-ls.
 
Uranus-ls is a lock-symbol.
Understand "uranus", "ouranos", "caelus" as Uranus-ls.
 
Pluto-ls is a lock-symbol.
Understand "pluto", "hades" as Pluto-ls.
 
Aries-ls is a lock-symbol.
Understand "aries", "ram" as Aries-ls.
 
Taurus-ls is a lock-symbol.
Understand "taurus", "bull" as Taurus-ls.
 
Gemini-ls is a lock-symbol.
Understand "gemini", "twin", "twins" as Gemini-ls.
 
Cancer-ls is a lock-symbol.
Understand "cancer", "crab" as Cancer-ls.
 
Leo-ls is a lock-symbol.
Understand "leo", "lion" as Leo-ls.
 
Virgo-ls is a lock-symbol.
Understand "virgo", "virgin", "maiden" as Virgo-ls.
 
Libra-ls is a lock-symbol.
Understand "libra", "scale", "scales", "balance" as Libra-ls.
 
Scorpio-ls is a lock-symbol.
Understand "scorpio", "scorpion" as Scorpio-ls.
 
Ophiuchus-ls is a lock-symbol.
Understand "ophiuchus", "serpent", "snake" as Ophiuchus-ls.
 
Sagittarius-ls is a lock-symbol.
Understand "sagittarius", "archer", "centaur" as Sagittarius-ls.
 
Capricorn-ls is a lock-symbol.
Understand "capricorn", "goat" as Capricorn-ls.
 
Aquarius-ls is a lock-symbol.
Understand "aquarius", "water", "water-bearer", "water-carrier", "bearer", "carrier" as Aquarius-ls.
 
Pisces-ls is a lock-symbol.
Understand "pisces", "fish", "fishes" as Pisces-ls.
 
Alpha is a lock-symbol.
Beta is a lock-symbol.
Gamma is a lock-symbol.
Delta is a lock-symbol.
Epsilon is a lock-symbol.
Zeta is a lock-symbol.
Eta is a lock-symbol.
Theta is a lock-symbol.
Iota is a lock-symbol.
Kappa is a lock-symbol.
Lambda is a lock-symbol.
Mu is a lock-symbol.
Nu is a lock-symbol.
Xi is a lock-symbol.
Omicron is a lock-symbol.
Pi is a lock-symbol.
Rho is a lock-symbol.
Sigma is a lock-symbol.
Tau is a lock-symbol.
Upsilon is a lock-symbol.
Phi is a lock-symbol.
Chi is a lock-symbol.
Psi is a lock-symbol.
Omega is a lock-symbol.
 
[Optimization hack!]
To decide whether symbol (M - lock-symbol) between (min-val - lock-symbol) and (max-val - lock-symbol):
    (- {M} >= {min-val} && {M} <= {max-val} -).
 
Definition: a lock-symbol is common-planet-symbol if  symbol it between Sun-ls and Uranus-ls.
 
Definition: a lock-symbol is common-zodiac-symbol if  symbol it between Aries-ls and Pisces-ls.
 
Definition: a lock-symbol is greek-symbol if  symbol it between Alpha and Omega.
 
To say (L - lock-symbol):
    if L is:
        -- Sun-ls: say "Sol";
        -- Mercury-ls: say "Mercury";
        -- Venus-ls: say "Venus";
        -- Earth-ls: say "Earth";
        -- Luna-ls: say "Luna";
        -- Mars-ls: say "Mars";
        -- Jupiter-ls: say "Jupiter";
        -- Saturn-ls: say "Saturn";
        -- Uranus-ls: say "Uranus";
        -- Pluto-ls: say "Pluto";
        -- Aries-ls: say "Aries";
        -- Taurus-ls: say "Taurus";
        -- Gemini-ls: say "Gemini";
        -- Cancer-ls: say "Cancer";
        -- Leo-ls: say "Leo";
        -- Virgo-ls: say "Virgo";
        -- Libra-ls: say "Libra";
        -- Scorpio-ls: say "Scorpio";
        -- Ophiuchus-ls: say "Ophiuchus";
        -- Sagittarius-ls: say "Sagittarius";
        -- Capricorn-ls: say "Capricorn";
        -- Aquarius-ls: say "Aquarius";
        -- Pisces-ls: say "Pisces";
        -- Alpha : say "[em]alpha[/em]";
        -- Beta : say "[em]beta[/em]";
        -- Gamma : say "[em]gamma[/em]";
        -- Delta : say "[em]delta[/em]";
        -- Epsilon : say "[em]epsilon[/em]";
        -- Zeta : say "[em]zeta[/em]";
        -- Eta : say "[em]eta[/em]";
        -- Theta : say "[em]theta[/em]";
        -- Iota : say "[em]iota[/em]";
        -- Kappa : say "[em]kappa[/em]";
        -- Lambda : say "[em]lambda[/em]";
        -- Mu : say "[em]mu[/em]";
        -- Nu : say "[em]nu[/em]";
        -- Xi : say "[em]xi[/em]";
        -- Omicron : say "[em]omicron[/em]";
        -- Pi : say "[em]pi[/em]";
        -- Rho : say "[em]rho[/em]";
        -- Sigma : say "[em]sigma[/em]";
        -- Tau : say "[em]tau[/em]";
        -- Upsilon : say "[em]upsilon[/em]";
        -- Phi : say "[em]phi[/em]";
        -- Chi : say "[em]chi[/em]";
        -- Psi : say "[em]psi[/em]";
        -- Omega : say "[em]omega[/em]";
        -- otherwise: say L.
 
Section - The Horological Calculator
 
The blank-tin-slip is a metallic takeable-thing. The printed name is "blank tin slip".
Understand "tin", "slip", "strip", "slip of", "strip of" as the blank-tin-slip.
Understand "blank" as the blank-tin-slip.
The description is "It's a small rectangular strip of tin[if the blank-tin-slip is in the calc-slot], lying in the Calculator's intake slot[end if]."
The lens-view is "Jupiter".
 
The mark-tin-slip is a metallic takeable-thing. The printed name is "ephemeris billet".
The mark-tin-slip can be correct or incorrect.
The mark-tin-slip can be ruined or unruined.
Understand "tin", "slip", "strip", "slip of", "strip of" as the mark-tin-slip.
Understand "engraved", "ephemeris", "ephemeral", "billet" as the mark-tin-slip.
 
Definition: a thing is tin-slip rather than non-tin-slip if it is the blank-tin-slip or it is the mark-tin-slip.
To decide what number is the tin-slip-correctness of (T - thing):
    if T is not the mark-tin-slip:
        decide on 0;
    if the mark-tin-slip is ruined:
        decide on 1;
    if the mark-tin-slip is incorrect:
        decide on 2;
    decide on 3.
 
Check examining the mark-tin-slip:
    if the mark-tin-slip is ruined:
        instead say "The billet has been overprinted. Layers of engraving criss-cross untidily across the tin slip. Whatever it's supposed to signify, it probably doesn't any more.";
    instead say "The strip of tin is now an ephemeris billet. It has been engraved with rows of minute symbols, indicating a particular confluence of the heavens from a particular vantage point in the Universe."
 
Check inspecting the mark-tin-slip with the planetary-lens:
    instead say "When viewed through the lens, the tin billet appears as Jupiter overlaid with a fine skein of celestial coordinates."
 
The calculator is a recallable scenery thing. The printed name is "Horological Calculator".
The calculator has a number called the lock-counter.
Understand "horological", "calculator", "computer", "machine", "machinery", "control", "controls", "equipment", "console", "desk" as the calculator.
The calculator is in the Obs-Nook.
 
Check examining the calculator:
    say "This majestic piece of machinery is intended to condense heavenly observations into a portable form. You've used the result -- small slips of tin engraved with the equivalent of dozens of astronomical ephemera; they're crucial for certain very precise sorts of alchemical operations";
    if billet-creation is not ever-done:
        say ". But you've never used the Calculator itself. That's Aithery work";
    else if billet-creation is not correct:
        say ". But you're not sure how to operate the Calculator itself. That's Aithery work";
    say ".[para]";
    say "The Calculator is the size of a large console desk. The upper surface is dominated by an armillary sphere, or rather a nested set of spheres: gleaming brass orbits and cycles, balanced to follow the movements of the visible stars. On the front is a smaller dial, surrounded by the marks of the Greek alphabet, to which it can be set. Next to the dial is a tiny slot";
    if the blank-tin-slip is in the calc-slot:
        say ".[para]A tin slip rests in the slot, ready for engraving";
    if the mark-tin-slip is in the calc-slot:
        say ".[para]The billet is back in the slot, even though overprinting the tin is probably a bad idea";
    instead say "."
 
Check searching the calculator:
    instead try examining the calculator.
 
Check reading the calculator:
    instead try reading the calc-spheres.
 
Check inspecting the calculator with the planetary-lens:
    instead say "You look at the horological calculator through the lens. Then you look away, blinking away a terrible headache."
 
Check inspecting the calculator with the oculus:
    instead say "Through the oculus, the horological calculator looks like a vast complexity of brass gears and mechanisms. Not too different from the mundane view, really."
 
Check taking the calculator:
    instead say "It's enormous. And bolted down, as well."
 
Check inserting a tin-slip thing into the calculator:
    instead try inserting the noun into the calc-slot.
 
Check vague-setting the calculator:
    instead try turning the calc-dial.
Check switching on the calculator:
    instead try turning the calc-dial.
 
Check setting the calculator to:
    instead try setting the calc-dial to the topic understood.
 
Check repairing the calculator:
    instead try repairing the calc-spheres.
 
After recalling the calculator when calc-combo-fact is known:
    say "[description of calc-combo-fact][br]".
 
The calc-slot is a container part of the calculator. The printed name is "intake slot".
The calc-slot is fixed in place.
Understand "tiny", "intake", "slot" as the calc-slot.
 
Check inserting the mercury into the calc-slot:
    instead say "[The noun] would just dribble through the machinery."
 
Check inserting a non-tin-slip thing into the calc-slot:
    if the noun is a metal-wire:
        instead say "You could probably push the wire into the slot, but it wouldn't suit the machinery.";
    instead say "[The noun] won't fit into the slot."
 
Report inserting a tin-slip thing into the calc-slot:
    instead say "You slide [the noun] back into the intake slot."
 
The calc-spheres are a plural-named part of the calculator. The printed name is "armillary spheres".
The calc-spheres are fixed in place.
Understand "armillary", "sphere", "spheres", "nested", "brass", "orbit", "orbits", "cycle", "cycles", "gear", "gears", "delicate" as the calc-spheres.
The description is "The Calculator contains eight nested brass spheres, supported in delicate armillary gears. The spheres are piercework, of course, so that you can see down to the center; each is engraved with orbits, stars, nebulae, and the other landmarks of the heavens. By adjusting the Calculator, you can match the spheres up to the observatory's environment... or at least, a trained Aithery pilot could.[para][calc-settings-desc][run paragraph on]".
 
Check reading the calc-spheres:
    instead say "[calc-settings-desc]".
 
Check searching the calc-spheres:
    instead say "[calc-settings-desc]".
 
Check inspecting the calc-spheres with the planetary-lens:
    instead try inspecting the calculator with the planetary-lens.
Check inspecting the calc-spheres with the oculus:
    instead try inspecting the calculator with the oculus.
 
Check taking the calc-spheres:
    instead say "The spheres are built into the Horological Calculator. Pulling them out would reduce them to brass junk."
 
Check turning the calc-spheres:
    instead say "You can't turn the spheres by hand! It would do something horrible to the gearwork. Use the dial."
 
Check pushing the calc-spheres:
    instead try turning the calc-spheres.
Check pulling the calc-spheres:
    instead try turning the calc-spheres.
Check vague-setting the calc-spheres:
    instead try turning the calc-spheres.
Check switching on the calc-spheres:
    instead try turning the calc-spheres.
 
Check setting the calc-spheres to:
    instead try setting the calc-dial to the topic understood.
 
Check inserting something into the calc-spheres when the noun is not the clock-tincture:
    instead say "You can't just drop things into the gearwork! It would jam them hopelessly."
 
Check topically-applying the clock-tincture to the calculator:
    instead try topically-applying the clock-tincture to the calc-spheres.
 
Report topically-applying the clock-tincture to the calc-spheres:
    say "You slowly pour the tincture into the guts of the Calculator. Just as slowly, the spheres begin to turn, until they are all aligned:";
    set the calculator symbols correctly;
    now the lock-counter of the calculator is zero;
    repeat with N running from 0 to 7:
        say "[if N is zero] [else], [end if]";
        say calculator symbol N;
    say ".[para]";
    process the calculator;
    stop the action;
 
Check repairing the calc-spheres:
    let score be the calculator correct score;
    if score is not calculator combo length:
        instead say "The spheres are out of alignment, but the mechanism itself doesn't seem to be damaged... fortunately. You wouldn't have a notion how to repair it.";
    else:
        instead say "The spheres seem to be in order now."
 
To say calc-settings-desc:
    let score be the calculator correct score;
    say "Each sphere is marked with a scale in Greek letters. From the outside in, the spheres are aligned at";
    repeat with N running from 0 to 7:
        say "[if N is zero] [else], [end if]";
        say calculator symbol N;
    if score is not calculator combo length:
        say ".[para]However, the patterns marked on the spheres don't seem to match the visible heavens at all";
    else:
        say ".[para]As best you can tell, the spheres are in alignment with the visible heavens";
    say "."
 
The calc-dial is a readable part of the calculator. The printed name is "dial".
The calc-dial is fixed in place.
Understand "smaller", "dial" as the calc-dial.
The description is "The dial can be set to any of the twenty-four Greek letters."
 
Check turning the calc-dial:
    if the calc-combo-fact is known and the billet-creation is ever-done:
        [Generic turning can be taken as goal-performing once solved. Also applies to vague-setting.]
        instead goal-perform billet-creation;
    instead say "The dial can be set to any of the twenty-four Greek letters."
 
Check vague-setting the calc-dial:
    instead try turning the calc-dial.
Check switching on the calc-dial:
    instead try turning the calc-dial.
 
Check setting the calc-dial to:
    if the topic understood completes the calculator combination:
        process the calculator;
    stop the action.
 
To process the calculator:
    say "An escapement whirrs";
    let the score be calculator correct score;
    let correct-combo be whether or not the score is calculator combo length;
    if correct-combo is true:
        say ". The patterns on the spheres seem to match the stars arrayed around you, as far as you can tell";
    unless a tin-slip thing (called T) is in the calc-slot:
        say ". However, the intake slot is empty; there is no tin slip to be drawn into the Calculator. The machinery rattles disappointedly for a moment, and then falls silent.";
        stop;
    say ". [The T] is drawn into the Calculator.[para]After a brief cantata of rattles and clunking noises, the slip is ejected back into your hands";
    mark the billet-creation as done;
    if T is the blank-tin-slip:
        retire T by transformation into the mark-tin-slip;
        now the mark-tin-slip is unruined;
        if correct-combo is true:
            mark calc-combo-fact as known;
            now mark-tin-slip is correct;
            now billet-creation is correct;
        else:
            now mark-tin-slip is incorrect;
        now the player carries the mark-tin-slip;
        say ", now imprinted with complex symbols. It is now [a mark-tin-slip], summarizing the heavenly coordinates you have set up.";
    else:
        now mark-tin-slip is ruined;
        now mark-tin-slip is incorrect;
        now the player carries the mark-tin-slip;
        say ". New symbols have been stamped over the old ones, rendering the billet rather unreadable.";
    stop.
 
To refuse the combination for (T - calc-dial) with (newsnip - snippet) and (L - lock-symbol) and (isnumber - truth state):
    if L is a common-planet-symbol or L is a common-zodiac-symbol:
        say "[L] is probably on the calculator somewhere, but the dial is set in Greek letters.";
    else if newsnip matches "[number]":
        say "The lock is set in Greek letters, not numbers.";
    else:
        say "The lock has no '[newsnip]' setting."
 
Include (-
Constant CALCULATOR_SIZE 8;
Array calculator_current --> CALCULATOR_SIZE;
 
[ CalculatorReset;
    calculator_current-->0 = (+ Gamma +);
    calculator_current-->1 = (+ Pi +);
    calculator_current-->2 = (+ Sigma +);
    calculator_current-->3 = (+ Tau +);
    calculator_current-->4 = (+ Alpha +);
    calculator_current-->5 = (+ Kappa +);
    calculator_current-->6 = (+ Xi +);
    calculator_current-->7 = (+ Theta +);
];
[ CalculatorSetCorrect;
    calculator_current-->0 = (+ Zeta +);
    calculator_current-->1 = (+ Rho +);
    calculator_current-->2 = (+ Pi +);
    calculator_current-->3 = (+ Omicron +);
    calculator_current-->4 = (+ Iota +);
    calculator_current-->5 = (+ Pi +);
    calculator_current-->6 = (+ Beta +);
    calculator_current-->7 = (+ Mu +);
];
[ CalculatorCountCorrect val;
    val = 0;
    if (calculator_current-->0 == (+ Zeta +) ) val++;
    if (calculator_current-->1 == (+ Rho +) ) val++;
    if (calculator_current-->2 == (+ Pi +) ) val++;
    if (calculator_current-->3 == (+ Omicron +) ) val++;
    if (calculator_current-->4 == (+ Iota +) ) val++;
    if (calculator_current-->5 == (+ Pi +) ) val++;
    if (calculator_current-->6 == (+ Beta +) ) val++;
    if (calculator_current-->7 == (+ Mu +) ) val++;
    return val;
];
[ CalculatorSetRandom val;
    for (val = 0 : val < CALCULATOR_SIZE : val++ ) {
        calculator_current-->val = (+ Alpha +) + random(24) - 1;
    }
    ! Disallow a correct answer!
    if (calculator_current-->4 == (+ Iota +) )
        calculator_current-->4 = (+ Theta +);
];
[ CalculatorGet pos;
    if (pos < 0 || pos >= CALCULATOR_SIZE)
        return (+ no-lock-symbol +);
    return calculator_current-->pos;
];
[ CalculatorSet pos val;
    if (pos < 0 || pos >= CALCULATOR_SIZE)
        return;
    calculator_current-->pos = val;
];
-).
 
To decide what number is the calculator combo length: (- (CALCULATOR_SIZE) -).
To reset the calculator symbols: (- CalculatorReset(); -).
To set the calculator symbols correctly: (- CalculatorSetCorrect(); -).
To set the calculator symbols randomly: (- CalculatorSetRandom(); -).
To decide what number is the calculator correct score: (- (CalculatorCountCorrect()) -).
To decide what lock-symbol is the calculator symbol (N - number): (- (CalculatorGet({N})) -).
To set the calculator symbol (N - number) to (L - lock-symbol): (- CalculatorSet({N}, {L}); -).
 
 
Chapter - Locations
 
Include HL Game Locs by Andrew Plotkin.
 
 
Chapter - Information
 
Section - Paper Classes
 
The paper-bundle is a readable takeable-thing. The printed name is "bundle of paper".
Understand "paper", "bundle", "bundle of", "sheets", "recipes" as the paper-bundle.
Understand "sheet", "sheet of", "recipe" as the paper-bundle.
Understand "instructions" as the paper-bundle when the location is the 2nd-Lab. [Hand-holding for the beginning sequence.]
 
[In theory I could support "CONSULT BUNDLE ABOUT TARNISH RITUAL", but it's a lot of extra work to make a less-reliable RECALL synonym. So no.]
 
Does the player mean doing something to the paper-bundle:
    it is unlikely.
 
Check recalling the paper-bundle:
    tutor tut-recall-paper-bundle;
    continue the action.
 
Check dropping the paper-bundle:
    instead say "Better to keep the bundle of instructions on hand."
 
Check inserting the paper-bundle into:
    [Some insert actions take precedence over this. E.g., putting it into the kiln.]
    instead try dropping the paper-bundle.
Check inserting the paper-bundle into a ritual-bound (called B) when the noun is takeable:
    instead try dropping the paper-bundle.
Check inserting the paper-bundle into the beaker when rstate is active:
    instead try dropping the paper-bundle.
Check inserting the paper-bundle into the beaker when rstate is not active:
    instead try dropping the paper-bundle.
Check putting the paper-bundle on:
    instead try dropping the paper-bundle.
 
Rule for moisturizing the paper-bundle:
    [This is kind of rude, since we force the player to jump into pools. Fortunately the bundle is extremely nonessential.]
    clear out the paper-bundle;
    dissolve subject.
 
Rule for incinerating the paper-bundle:
    clear out the paper-bundle;
    burn subject.
 
Rule for enkilning the paper-bundle:
    say "The paper is instantly incinerated. Good thing you have a good memory.";
    clear out the paper-bundle;
    rule fails.
 
[Collected means currently in the bundle. Resettable.]
A formula can be collected or uncollected.
An action-goal can be collected or uncollected.
A tidbit can be collected or uncollected.
 
To clear out the paper-bundle:
    now all tidbits are uncollected;
    now all formulas are uncollected;
    now all action-goals are uncollected.
 
Check examining the paper-bundle:
    tutor tut-examine-bundle;
    let N be the number of collected formulas;
    let M be the number of collected action-goals;
    let P be the number of collected tidbits;
    if N is zero and M is zero and P is zero:
        instead say "(BUG) All of this paper is blank.";
    say "These are all the bits of paper you've picked up recently";
    if N is one:
        say ". The bundle contains [the random collected formula]";
    else if N is greater than one:
        say ". The bundle contains [the list of collected formulas]";
    say "[if N is zero]. The bundle contains[else]; it also describes[end if]";
    if M is one:
        say " [the random collected action-goal]";
    else if M is greater than one:
        say " [the list of collected action-goals]";
    if P is one:
        say "[if M is not zero], as well as[end if] [the random collected tidbit]";
    else if P is greater than one:
        say "[if M is not zero], as well as[end if] [the list of collected tidbits]";
    if there is an uncollected known formula or there is an uncollected known action-goal:
        say ". You have more memorized, of course -- you don't need to refer to the paper to use them";
    instead say "."
 
To decide what bare-array is sheetlist-bare-array: (- sheetlist_barearray -).
Include (-
! Just needs to be enough for a single paper-sheet's contents.
Array sheetlist_barearray table 8;
-).
 
Paper-sheet-processing is an object-based rulebook.
 
The first paper-sheet-processing rule:
    clear sheetlist-bare-array.
 
A paper-sheet is a kind of thing. [Not a takeable-thing, because we're not going to track them in the recall/find system. They're never truly handled, anyhow.]
A paper-sheet has an object called the home-location. The home-location of a paper-sheet is usually nothing.
Understand "paper", "sheet", "sheet of", "recipe", "receipt", "instructions" as a paper-sheet.
Understand "sheets", "papers" as the plural of paper-sheet.
 
A paper-sheet is always readable.
A paper-sheet can be known or unknown. A paper-sheet is usually unknown.
The description of a paper-sheet is usually "(BUG) Sheet missing description."
 
Check taking a paper-sheet:
    instead try examining the noun.
 
Check searching a paper-sheet:
    instead try examining the noun.
 
Check examining a paper-sheet:
    follow the paper-sheet-processing rulebook for the noun;
    let N be the count of sheetlist-bare-array;
    if N is zero:
        instead say "(BUG) This sheet is blank!";
    if the noun is unknown:
        let action-goal-count be zero;
        let formula-count be zero;
        let new-formula be no-word;
        repeat with index running from 0 to N - 1:
            let O be the object index of sheetlist-bare-array;
            now O is collected;
            mark O as known;
            if O is an action-goal:
                increment action-goal-count;
            else if O is a formula:
                now new-formula is O;
                increment formula-count;
        now the noun is known;
        say the description of the noun;
        say "[para]You memorize";
        if action-goal-count is zero:
            say " the information";
        else:
            say " the instructions";
        if formula-count is zero:
            say ", and also";
        else:
            if formula-count is one:
                say ", including [the new-formula]";
            else:
                say ", including the [formula-count in words] formulae";
            say ". You also";
    else:
        repeat with index running from 0 to N - 1:
            let O be the object index of sheetlist-bare-array;
            now O is collected;
        say "The paper contains [the list of sheetlist-bare-array]";
        say ", [if N is 2]both of [end if][if N > 2]all of [end if]which you already know";
        say ". You";
    now the noun is off-stage;
    if the atmosphere of the location is fire-atm:
        instead say " pick up the sheet, but it crumbles to ash in your hands. Fortunately your memory is good.";
    if the player does not carry the paper-bundle:
        now the player carries the paper-bundle;
        say " pick up the sheet. Just in case";
    else:
        say " add the sheet to your bundle of paper";
    set pronouns from the paper-bundle;
    instead say "."
 
A memspark is a kind of thing. [A lot like paper-sheets.]
Understand "spark", "light" as a memspark.
 
A memspark can be known or unknown. A memspark is usually unknown.
A memspark is usually scenery.
A memspark is usually not prominent-scenery. [But becomes temporarily so when detected.]
A memspark is usually low-locale-priority.
A memspark can be lessony or gossipy. A memspark is usually lessony.
The description of a memspark is usually "(BUG) Spark missing description."
 
The known-memspark-count is a number that varies. The known-memspark-count is zero.
 
[We rely on the fact that no room contains more than one memspark. This is set at room-visiting time.]
The local-memspark is an object that varies.
 
[May be true after entering a room with an unknown memspark, or using an oculus ditto.]
The notice-memspark-flag is a truth state that varies.
 
[Any room that you've oculus-scanned in, whether you found a spark or not. Not resettable.]
A room can be spark-checked or non-spark-checked.
A reset-room is usually spark-checked. [Eliminate these from the list.]
 
To mark the location as spark-checked: now the location is spark-checked.
 
To recite the spark-unchecked rooms:
    if known-memspark-count is greater than one and there is a non-spark-checked visited room:
        say "The following rooms still need to be checked with the oculus for sparks:[br]";
        repeat with O running through visited non-spark-checked rooms:
            say "[indentation 2][the O][br]";
 
Every turn when notice-memspark-flag is true (this is the mention noticing a memspark rule):
    now notice-memspark-flag is false;
    if the player is the holder of the oculus and local-memspark is not nothing and local-memspark is not prominent-scenery:
        if known-memspark-count is zero:
            say "Odd. You notice a spark in the oculus, as if it were reflecting some light not present.";
        else:
            say "You catch a spark of light reflected in the oculus from somewhere.";
 
Before room-visiting:
    [Remember that room-visiting can happen many times in a turn. We make sure that setting the flag isn't cumulative in this rule.]
    if local-memspark is not nothing:
        now local-memspark is not prominent-scenery;
    now notice-memspark-flag is false;
    if a memspark (called T) is in the location:
        now local-memspark is T;
        if local-memspark is unknown and the player is the holder of the oculus and a random chance of 1 in 4 succeeds:
            now notice-memspark-flag is true;
    else:
        now local-memspark is nothing.
 
Check searching the oculus when local-memspark is not nothing:
    [Do *not* mark the room spark-checked until the spark is known.]
    say "You peer through the oculus. Everything acquires a colorful, hazy fringe";
    if local-memspark is prominent-scenery:
        instead say ". You can also see [the local-memspark].";
    else:
        say ".[para]";
        instead try inspecting local-memspark with the oculus.
 
First check inspecting something with the oculus (this is the maybe notice a memspark while inspecting rule):
    [This winds up before the auto-take inspecting rule, which is not ideal. But I'll roll with it and allow for the possibility of not holding the oculus when we report noticing.]
    if local-memspark is not nothing and local-memspark is unknown and a random chance of 1 in 3 succeeds:
        now notice-memspark-flag is true;
    else:
        now notice-memspark-flag is false;
    [continue the action]
 
Check inspecting a not prominent-scenery memspark with the oculus:
    if the noun is not local-memspark:
        say "(BUG) [The noun] is not local-memspark ([local-memspark]).";
    now the noun is prominent-scenery;
    if the noun is known:
        instead say "You cast around until [the noun] comes into view.";
    instead say "[one of]Wait. There's something else.[para]It wasn't visible to the naked eye, but the oculus reveals[or]The oculus reveals[stopping] [a noun] floating in the [if the atmosphere of the location is vacuum-atm]vacuum[else]air[end if]."
 
Check inspecting a prominent-scenery memspark with the oculus:
    instead try examining the noun.
 
Check inspecting a memspark with the planetary-lens:
    if the noun is not prominent-scenery:
        instead say "You can't see any such spark.";
    instead say "The spark is not visible at all through the planetary lens."
 
Rule for printing the name of a not prominent-scenery memspark:
    say "spark".
 
Rule for writing a paragraph about a memspark (called T):
    if the player carries the oculus:
        say "Looking through the oculus, you can see [a T] hanging in the [if the atmosphere of the location is vacuum-atm]vacuum[else]air[end if].";
    else:
        say "You're not holding the oculus, but you know there's [a T] around here somewhere."
 
Instead of doing anything except examining or searching to a not prominent-scenery memspark:
    if inspecting a memspark with something:
        continue the action;
    instead say "You can't see any such spark."
 
Check recalling a memspark:
    instead try examining the noun.
 
Check touching a memspark:
    instead say "Your hand passes through [the noun], or vice versa."
Check taking a memspark:
    instead try touching the noun.
Check pushing a memspark:
    instead try touching the noun.
Check pulling a memspark:
    instead try touching the noun.
Check turning a memspark:
    instead try touching the noun.
 
Check putting something on a memspark:
    if the second noun is not prominent-scenery:
        instead try touching the second noun;
    else:
        instead say "The spark is intangible."
Check inserting something into a memspark:
    if the second noun is not prominent-scenery:
        instead try touching the second noun;
    else:
        instead say "The spark is intangible."
Check tapping something on a memspark:
    if the second noun is not prominent-scenery:
        instead try touching the second noun;
    else:
        instead say "The spark is intangible."
 
Check eating a memspark:
    instead say "Your tongue passes through [the noun], or vice versa."
Check tasting a memspark:
    instead try eating the noun.
 
Check searching a memspark:
    instead try examining the noun.
 
Check examining a not prominent-scenery memspark:
    instead say "You can't see any such spark.";
 
The spark-intro-cycler is a stopping-cycler. The limit is 3.
 
Check examining a prominent-scenery memspark:
    if the player does not carry the oculus:
        instead say "You can't see the spark, since you're not holding the oculus.";
    mark the location as spark-checked;
    follow the paper-sheet-processing rulebook for the noun;
    let N be the count of sheetlist-bare-array;
    if N is zero:
        instead say "(BUG) This spark is blank!";
    if the noun is unknown:
        let action-goal-count be zero;
        let formula-count be zero;
        let new-formula be no-word;
        repeat with index running from 0 to N - 1:
            let O be the object index of sheetlist-bare-array;
            mark O as known;
            if O is an action-goal:
                increment action-goal-count;
            else if O is a formula:
                now new-formula is O;
                increment formula-count;
        now the noun is known;
        increment the known-memspark-count;
        say "You focus on [the noun] through the oculus";
        if current spark-intro-cycler is:
            -- 1: say ". It's just a point of light, but...[para]A memory obtrudes. It's [if the noun is lessony]an alchemical lesson, but not one you ever attended; perhaps not in any classroom or laboratory you've ever seen. The details are unclear -- and yet the lesson[else]a wardroom story, but not one you ever remember hearing. The details are unclear -- and yet the tale[end if] is vivid in your mind. ";
            -- 2: say ". It's just a point of light, but once again, a memory comes clear in your mind -- a [if the noun is lessony]lesson you've never attended[else]story you've never heard[end if]. ";
            -- otherwise: say ". A new memory comes into focus. ";
        say the description of the noun;
        say "[para]You consider these memories";
        if formula-count is zero:
            do nothing;
        else:
            if formula-count is one:
                say ", including [the new-formula]";
            else:
                say ", including the [formula-count in words] formulae";
    else:
        say "You focus on [the noun] through the oculus";
        say ". It brings to mind [the list of sheetlist-bare-array]";
        say ", [if N is 2]both of [end if][if N > 2]all of [end if]which you already know";
    instead say "."
 
 
Include HL Game Recipes by Andrew Plotkin.
 
 
Chapter - Global Plot State
 
The initial tutorial query rule is listed before the initial world reset rule in the when play begins rulebook.
When play begins (this is the initial tutorial query rule):
    [if always:
        say "[bold]Pre-release edition. For press -- do not distribute this copy. Hadean Lands should be publically available on Oct 30. (http://hadeanlands.com/)[/bold][para][para]";]
    say "[parsermsg]Have you played interactive fiction before?[/parsermsg]";
    say "[br]>>[run paragraph on]";
    let answer be true;
    if release mode:
        now answer is whether or not player consents-or-restores;
    else:
        say "YES   (DEBUG)[line break]";
    if answer is false:
        now tutorial-display is true;
        say "[parsermsg]I'll give you some help, then. Just to get you started.[/parsermsg][line break]";
    else:
        now tutorial-display is false;
        say "[parsermsg]Great[exclam-mark]";
        if iOS-UI:
            say " If you need a refresher, flip to the Help tab[period]"; [This mentions the special commands so don't sweat that here.]
        else if Lectrote-UI:
            say " If you need a refresher, select the 'IF Reference Card' menu option[period]"; [Ditto.]
        else:
            say " You might want to type [excmd]COMMANDS[/excmd] to learn about special commands in this game[period]";
        say " On with the show.[/parsermsg][para]".
 
When play begins (this is the initial remove the syn-bridge doors rule):
    now real-opt-door is absent;
    now real-arms-door is absent;
    now real-door-SW is absent;
    now real-door-SE is absent;
    now real-door-SE is not ever-seen; [initial player location marks this ever-seen before the first turn]
 
When play begins (this is the initial intro text rule):
    say "You smell copal incense, machine oil, rosemary, alcohol, and blood. Creaking, bending steel beams... no, that's not an odor. Why did you think the bulkheads were crumpling in on you? What would that even smell like?[para]";
    say "You're pretty sure it's not your own blood, anyway.[para]";
    say "The secondary alchemy lab is your duty station this shift; where you were, before -- before now. Before you woke up on the floor. Smelling copal, oil, rosemary, and -- well, alcohol is right. You were scrubbing the workbench. [sarge]Enjoying your shift, swabbie?[/sarge][para]";
    say "[sarge]Not any more, Sarge.[/sarge][para]";
    say "The lamps shouldn't be flickering like that. And His Majesty's Marcher [TheFullRetort] really, [em]really[/em] shouldn't be this quiet.";
 
The custom initial room description rule is listed instead of the initial room description rule in the startup rulebook.
This is the custom  initial room description rule:
    tutor tut-initial;
    if tutorial-display is false:
        try looking.
 
[See also the must-look-first tutorial rule.]
 
[### Do we throw in a special exception for the first reset? To shout hints at the player in an empty room?]
 
To recite post-reset text:
    if not chapter-0-done:
        if reset-counter is:
            -- 0: say "(BUG) reset-counter is zero.";
            -- 1: say "...You fight off [em]deja vu.[/em] Everything is back as it was when you first awakened in the lab. The hatch is rusted shut, the supplies on the table are untouched. What in the name of... what has just happened?";
            -- 2: say "...You look around. Once again, the world has reset itself; everything you see is back where it started.";
            -- 3: say "...Once again, the world has reset itself.";
            -- 4: say "...Once again, the world has reset itself.";
            -- otherwise: say "...Back here again, it seems.";
    stop.
 
To decide whether escaped first room:
    if post-game:
        decide yes;
    if the 2nd-Crawl is visited:
        decide yes.
 
To decide whether chapter-0-done:
    if post-game:
        decide yes;
    if the Lab-Hall-SW is visited:
        decide yes.
 
[Becomes true at the end of chapter 1.]
Initial-marriage is a truth state that varies. Initial-marriage is false.
 
To decide whether chapter-1-done:
    if post-game:
        decide yes;
    if initial-marriage is true:
        decide yes.
 
To complete initial marriage:
    if initial-marriage is true:
        say "(BUG) Initial-marriage is already true!";
        stop;
    now initial-marriage is true;
    now the nave-script is off-stage;
    move-and-shadow Ch2-Captain to Scaphe-View with Sha-Captain and Ch1-Captain;
    move-and-shadow Ch2-Scholar to Deck-Suite with Sha-Scholar and Ch1-Scholar;
    move-and-shadow Ch2-Grafter to Lab-Wing-Hall with Sha-Grafter and Ch1-Grafter;
    move-and-shadow Ch2-Climber to Charred-Hall with Sha-Climber and Ch1-Climber;
    now the great-marriage is homunc-done;
    mark the great-marriage as done;
    now the home-location of the sh-homunculus-def is the Mech-Lab;
    now the follower is the homunculus;
    now the motility of the homunculus is zero;
    now the senility of the homunculus is zero;
    now the homunculus is in the Nave.
 
To decide whether chapter-2-done:
    if post-game:
        decide yes;
    if active-dragon is not no-dragon:
        decide yes.
 
To complete tertiary avatars:
    move-and-shadow Ch3-Captain to Lab-Hall-NE with Sha-Captain and Ch2-Captain;
    move-and-shadow Ch3-Scholar to Library with Sha-Scholar and Ch2-Scholar;
    move-and-shadow Ch3-Grafter to Mech-Lab with Sha-Grafter and Ch2-Grafter;
    move-and-shadow Ch3-Climber to Fire-Lab with Sha-Climber and Ch2-Climber;
 
To complete final avatar of (P - persona):
    if P is:
        -- Captain: move-and-shadow Ch4-Captain to (home of Syndesis) with Sha-Captain and Ch3-Captain;
        -- Scholar: move-and-shadow Ch4-Scholar to (home of Aistheta) with Sha-Scholar and Ch3-Scholar;
        -- Grafter: move-and-shadow Ch4-Grafter to (home of Pneuma) with Sha-Grafter and Ch3-Grafter;
        -- Climber: move-and-shadow Ch4-Climber to (home of Baros) with Sha-Climber and Ch3-Climber;
        -- otherwise: say "(BUG) Cannot complete final avatar of [P].";
 
To decide whether chapter-3-done:
    if post-game:
        decide yes;
    if active-dragon is not no-dragon and dead-dragon-count is 3:
        decide yes.
 
The post-game-flag is a truth state that varies.
The post-game-flag variable translates into I6 as "post_game_flag".
Include (-
Global post_game_flag = 0;
-) after "Global Variables" in "Output.i6t".
 
To decide whether post-game: (- (post_game_flag) -).
 
To complete the game proper with ballast (N - number):
    if not chapter-3-done:
        say "(BUG) Chapter 3 wasn't done, but we'll end the game anyhow.";
    now the ballast-level of Endgame-3 is N;
    now post-game-flag is true;
    now current-tense is past-tense;
    [We use "raw-remove ... from play" rather than "now ... is offstage" because, technically, the known-foo containers are already offstage.]
    repeat with T in raw contents of known-tidbits:
        now T is not known;
        raw-remove T from play;
    repeat with K in raw contents of known-rituals:
        now K is not known;
        raw-remove K from play;
    repeat with F in raw contents of known-formulas:
        if F is not the simple-seal-word:
            now F is not known;
            raw-remove F from play;
 
To complete the endgame:
    end the story finally saying "You will begin";
 
To decide whether script-legible:
    if glyph-1 is known:
        decide yes.
 
 
Chapter - The Characters
 
Understand "lieutenant", "lt", "jana", "anderes", "jan", "jane", "andres", "woman" as a character when the persona of the item described is Grafter.
Understand "lieutenant", "lt", "michael", "powes", "mike", "powys", "man" as a character when the persona of the item described is Climber.
Understand "ensign", "ens", "sydney", "ctesc", "sidney", "syd", "sid", "man" as a character when the persona of the item described is Scholar.
Understand "captain", "capt", "ashe", "hart", "woman" as a character when the persona of the item described is Captain.
Understand "sergeant", "sgt", "sarge", "brooks", "man" as a character when the persona of the item described is Sergeant.
 
To say (P - persona):
    if P is:
        -- Grafter: say "Lt Anderes";
        -- Climber: say "Lt Powes";
        -- Scholar: say "Ensign Ctesc";
        -- Captain: say "Captain Hart";
        -- Ensign: say "you";
        -- Sergeant: say "Sergeant Brooks";
        -- no-persona: say "(BUG) no-persona";
        -- otherwise: say "(BUG) ?-persona".
 
 
Section - General Character Text
 
To say the recalled-description of (C - character) present (present - truth state):
    let P be the persona of C;
    if P is:
        -- Captain: say "[if present is false]You recall Captain Hart:[else]Captain Hart is[end if] a dark, burly woman. Her head is shaved clean, and set off by a gleaming, not-quite-regulation gold earring. Ensigns walk in fear of being noticed by her. She looks like she could pick up an errant scrubbie and throw him off the [Retort] -- probably with one hand. (Not true, of course. She'd just frown and a lieutenant would do it for her.)";
        -- Scholar: say "[if present is false]You recall Ensign Sydney Ctesc. He is[else]Ensign Sydney Ctesc is[end if] Alchemy-file, like you; you often see him around the labs. You don't know him well; he's quiet, not to mention a year your senior. He's short and moon-faced, somehow with shaggy hair despite the marcher haircut.";
        -- Grafter: say "[if present is false]You recall Lieutenant Jana Anderes --[else]Lieutenant Jana Anderes is[end if] a tall woman with dark hair and a long pale face -- which is usually bent into a sour shape, contemplating the misdeeds of Alchemy-file ensigns such as yourself. Maybe she's more pleasant company off-duty; you'd hardly know. You've only usually seen her in her storerooms, stalking the shelves and begrudging every teaspoon of an alchemist's request.";
        -- Climber: say "[if present is false]You recall Lieutenant Michael Powes:[else]Lieutenant Michael Powes is[end if] a beanstalk of a man, fair-skinned, with deep-set eyes that always reminded you of a hungry snake. He's Aithery-file, a junior Observatory officer; he spends his days over on the far side of the marcher where you rarely go.";
        -- otherwise: say "(BUG) No recalled-description."
 
To say the oc-message-basic for (C - character):
    let P be the persona of C;
    if P is:
        -- Captain: say "'I suspect that the Captain has been fraternizing with an officer under her command. I realize the seriousness of this charge, and I have no direct evidence to offer. However, I am sure that she has been adjusting duty schedules to this end, and to the detriment of the [Retort's] good conduct. Please look into this. --N'[br]";
        -- Scholar: say "'I am concerned about Sydney. Diligence is commendable, but I fear that his thirst for alchemical lore may lead him down dangerous byways. He has made shrift to get hold of textbooks not normally available to students, at least.'";
        -- Grafter: say "'I must bring to your attention certain discrepancies in the storage records. Significant quantities of reagents have vanished -- always those rare and most dearly sold on the black markets at home. The records have been skillfully obscured, but the evidence implicates Lt Anderes.'";
        -- Climber: say "'I am certain that Lt Powes has been covertly compromising alchemical supplies. What is less clear is his motivation. The contaminated reagents are not in Powes['] area of oversight, which suggests that he is setting up another officer for blame. Please permit my discretion in investigating this further. --M'[br]";
        -- otherwise: say "(BUG) No oc-message-basic."
 
To say the oc-message-final for (C - character):
    let P be the persona of C;
    let R be the resolution of P;
    if R is no-persona:
        say "(BUG) [P] has no resolution.";
        stop;
    if P is Captain:
        if R is:
            -- Captain: say "(BUG) [P] resolves to self.";
            -- Scholar: say "'I have confirmed that Captain Hart has been conducting a covert affair -- with a junior officer, no less: Ensign Sydney Ctesc.[para]'Ctesc has apparently been delving into restricted alchemical texts; the Captain has both encouraged and helped to conceal these activities. The specter of a [']love potion['] must arise in these situations, but I do not think that Ctesc's research has managed anything so fantastical. The Captain must be honestly smitten. It is a breach of her discipline that I could not have imagined.[para]'The danger of Ctesc's work has not, I think, escaped her. The messages I have intercepted imply that she fears some alchemical disaster, but not an imminent one. I am not so complacent, however. --N'[br]";
            -- Grafter: say "'I have confirmed that Captain Hart has been conducting a covert affair with Lt Jana Anderes.[para]'Anderes is apparently involved in some black-market operation, stealing supplies from the [Retort] and selling them at port. The Captain seems to be entirely unaware of this situation -- so we may hold her to account for breach of discipline, but not outright criminal enterprise. This is small comfort, I realize.[para]'I would normally [em]not[/em] bring fraternization to light while rigged for the march. Better to deal with the situation quietly at port; and I clutch the hope that the Captain will come to her senses. However, Anderes['] actions have left the [Retort] critically short of certain reagents. We may not have the leisure to wait. --N'[br]";
            -- Climber: say "'I have confirmed that Captain Hart has been conducting a covert affair with Lt Michael Powes.[para]'The situation is fraught. Powes appears to have been contaminating the [Retort's] alchemical supplies -- part of some scheme to discredit another officer. I believe that Hart is aware of this, and is manipulating Powes to learn more. Powes does not know himself under suspicion; he genuinely believes that the Captain is indulging in an affaire d'coeur. How he reconciles such a breach with the Captain's record, I cannot speculate.[para]'Nor can I imagine why the Captain feels the need to investigate through such melodramatic means. But Powes['] depredations are becoming a serious problem. I intend to approach the Captain privately and broach the question at the first opportunity. --N'[br]";
    if P is Scholar:
        if R is:
            -- Captain: say "'The situation is most disturbing. It appears that Sydney Ctesc has indeed been reaching for advanced alchemical knowledge. But worse: he is gathering it by means of a subtle chi-ritual, extracting knowledge directly from the mind of another. And worse yet: his target is Captain Hart![para]'Such rituals are of course dangerous to both parties. I do not believe that Ctesc has yet lost control of his alchemy. But a failure could occur at any time. I must insist that Ctesc be taken into custody.'";
            -- Scholar: say "(BUG) [P] resolves to self.";
            -- Grafter: say "'It appears that Sydney Ctesc has indeed been reaching for advanced alchemical knowledge. But worse: it appears that he is collaborating with Jana Anderes, in Supply. Anderes locates texts in storage, and in return Ctesc aids her in transporting supplies off the [Retort] for sale on the black market.[para]'As a result, the [Retort] is becoming critically short on certain reagents; and who knows what Ctesc is up to with his texts. We will certainly have to bring charges against them both.'";
            -- Climber: say "'It appears that Sydney Ctesc has indeed been reaching for advanced alchemical knowledge. But worse: it appears that he is collaborating with Lieutenant Powes. Powes has been passing restricted texts to Ctesc; in return, Ctesc has been aiding Powes in tampering with certain supplies.[para]'Ctesc has a deeper aim than merely sabotaging the [Retort]. I hope to learn more soon; but in any case, we will have to intervene before the contaminated reagents cause a serious incident.'";
    if P is Grafter:
        if R is:
            -- Captain: say "'I have evidence that Jana Anderes is guilty of graft. She has been slowly removing rare reagents from storage, transporting them off the [Retort] when in home port, and profiting from their illicit sale.[para]'This much I knew weeks ago. It has taken me much longer to confirm who Anderes is working with... for I required the hardest of proof. I am now convinced that Captain Hart is involved in the crime. She must have discovered it -- and rather than bringing Anderes to marchcourt, decided to let the business continue under her own thumb.[para]'Needless to say, we cannot bring this to light until the [Retort] reaches home port. But we are becoming critically short on certain supplies, and I fear for the safety of the marcher.'";
            -- Scholar: say "'I have firm evidence that Jana Anderes is guilty of graft. She has been slowly removing rare reagents from storage, transporting them off the [Retort] when in home port, and profiting from their illicit sale.[para]'Her partner in this enterprise is Ensign Sydney Ctesc. The Ensign has been helping her transport supplies, in return -- I believe -- for access to restricted alchemical texts. I hope to learn more soon. But in any case, the [Retort] is becoming critically short on certain supplies. We will have to bring charges against them both.'";
            -- Grafter: say "(BUG) [P] resolves to self.";
            -- Climber: say "'I have firm evidence that Jana Anderes is guilty of graft. She has been slowly removing rare reagents from storage, transporting them off the [Retort] when in home port, and profiting from their illicit sale.[para]'She is being aided in this enterprise by Lieutenant Powes; he has been using his authority to cover up Anderes['] thefts, and also to hide the stolen supplies before their sale. I suppose he takes a share of the profit, although I have not yet been able to confirm this. But in any case, the [Retort] is becoming critically short on certain supplies. We will have to bring charges against them both.'";
    if P is Climber:
        if R is:
            -- Captain: say "'Powes['] depredations, we find, have been calculatedly random -- not so localized as to implicate any particular superior officer. Instead, the result has been a steady decrease in the [Retort's] [em]overall[/em] operational efficiency. The Ministry has not yet acted, but if this continues, they will.[para]'Lacking evidence of wrongdoing, the blame will inevitably fall upon Captain Hart. Thus we must assume that the Captain is Powes['] target. She would not face marchcourt for running a [']scruffy ship['], but she would likely be transferred to a lesser command.[para]'I extended my search, and discovered lengthy correspondence between Powes and Captain Mehta of the [em]Lightfire[/em]. Captain Mehta is in the offing for a favorable command, and so we must assume...'";
            -- Scholar: say "'Powes['] depredations, we find, are spread across several of the laboratories used by Alchemy-file ensigns. More specifically, he has been contaminating the stores most often used by Ensign Sydney Ctesc.[para]'I understand that Ctesc has been covertly experimenting with illicit rituals. It now seems that Powes discovered this; rather than notifying his ranking officer, he took it upon himself -- equally covertly -- to interfere with Ctesc's work.[para]'Whether Powes intended to blackmail Ctesc in some way, or insinuate himself by [']helping['] Ctesc with his failures, I have yet to determine. However, we will have to intervene soon; the risk of some uncontrolled alchemical disaster grows by the day...'";
            -- Grafter: say "'Powes['] depredations, we find, are concentrated in the Supply department overseen by Lt Jana Anderes. I understand that Anderes has been stealing alchemical supplies, so we must conclude that Powes is targetting Anderes['] black-market efforts.[para]'I confess I am shocked by the depth of criminal action on this marcher. Is this sort of villainy widespread in the fleet? --But the business at hand. I am now attempting to discover whether Powes was intending to discredit and replace Anderes, or to undermine the marketeers that Anderes was working with, or some more devious scheme...'";
            -- Climber: say "(BUG) [P] resolves to self.";
 
To say character vocalization for (P - persona):
    if P is:
        -- Grafter: say "'How can I get the stuff out without being seen[question-mark]'";
        -- Climber: say "'How can I ensure that the blame falls as it should[question-mark]'";
        -- Scholar: say "'How can I get those books from the Rector's quarters[question-mark]'";
        -- Captain: say "'How can I clear out that crawlway without alerting anyone[question-mark]'";
 
To say final character vocalization for (P - persona):
    let R be the resolution of P;
    if R is no-persona:
        say "(BUG) [P] has no resolution[period]";
        stop;
    if P is Captain:
        if R is:
            -- Captain: say "(BUG) [P] resolves to self[period]";
            -- Scholar: say "'How can I meet Sydney in the crawlway without being seen[question-mark]'";
            -- Grafter: say "'How can I meet Jana in the crawlway without being seen[question-mark]'";
            -- Climber: say "'How can I meet Michael in the crawlway without being seen[question-mark]'";
    if P is Scholar:
        if R is:
            -- Captain: say "'If the Captain senses my probe, it'll be the death penalty[period]'";
            -- Scholar: say "(BUG) [P] resolves to self[period]";
            -- Grafter: say "'Anderes can't turn me in now; I've got as much on her thefts as she has on me[period]'";
            -- Climber: say "'Powes can't turn me in now; I've got as much on his sabotage as he has on me[period]'";
    if P is Grafter:
        if R is:
            -- Captain: say "'I can't sell the stuff off when the Captain is watching me. But why hasn't she nicked me yet[question-mark]'";
            -- Scholar: say "'I can't believe Ctesc is helping me sell the stuff off, in return for nothing but the books[period]'";
            -- Grafter: say "(BUG) [P] resolves to self[period]";
            -- Climber: say "'I can't believe Powes is helping me sell the stuff off without asking for a cut[period]'";
    if P is Climber:
        if R is:
            -- Captain: say "'The [Retort] is limping already. A few more [']mistakes['] and the Captain will be blamed[ellipsis]'";
            -- Scholar: say "'Ctesc has already had more than his share of accidents. A few more [']mistakes['] and he'll be banned from the lab[ellipsis]'";
            -- Grafter: say "'I doubt Anderes will notice until she tries to sell the stuff. How upset her buyers will be then[ellipsis]'";
            -- Climber: say "(BUG) [P] resolves to self[period]";
 
 
Section - Chapter Avatars
 
[Locations of the per-chapter characters are set manually, not tweaked at reset time.]
 
[Chapter 1: initial exploration]
 
Ch1-Grafter is a female scenery fracture-blocked character. The persona of Ch1-Grafter  is Grafter.
Ch1-Grafter is in the 2nd-Crawl.
[Locale paragraph is handled by the 2nd-fracture]
 
The description of Ch1-Grafter is "Jana Anderes is a pinch-faced lieutenant in the Lumber Department -- or, as it's officially named, Stores and Supply. You've occasionally dealt with her when you're sent to fetch this or that from the marcher's storerooms.[para]Now she's sneaking around in the crawlways... or she would be, if she weren't frozen in a fracture. Escaping, like you, from the [Retort's] catastrophe? But her attitude is somehow furtive, rather than uncertain.[para]Anderes is carrying a reagent jar. You can't make out its label, however."
 
The grafter-jar is a readable far-sight. The printed name is "reagent jar".
The grafter-jar is part of Ch1-Grafter.
Understand "jar", "jar of", "alchemical", "reagent", "label" as the grafter-jar.
 
The description of the grafter-jar is "Anderes is carrying an alchemist's jar. Not an ordinary flask, like the ones you use every day, but a full-size reagent jar from stores. Why...? Unfortunately, the way she's holding it, you can't see the label or the contents."
The reach-reason of the grafter-jar is "[Grafter]['] jar is behind the fracture, out of reach."
 
Ch1-Scholar is a male scenery fracture-blocked character. The persona of Ch1-Scholar is Scholar.
Ch1-Scholar is in the Safe-Store.
 
The description of Ch1-Scholar is "It's Sydney Ctesc -- an East Empire name, his family is from out that way. He's an ensign in Alchemy, same as you, though a year senior. Short, quiet, studies hard.[para]You see something, a sequence of symbols, scrawled on Ctesc's hand. And his attention seems to be directed towards the steel safe."
 
Instead of reading Ch1-Scholar:
    instead try examining the scholar-combo.
 
Check inspecting the Ch1-Scholar with the convex-lens:
    instead say "You peer through the convex lens. It doesn't help much. Ctesc's hand looks larger, but the angle isn't any better.";
 
Check inspecting the Ch1-Scholar with the concave-lens:
    instead say "You peer through the concave lens, but it just makes the symbols look smaller.";
 
Check inspecting the Ch1-Scholar with the planetary-lens:
    mark safe-combo-note as known;
    instead say "Through the planetary lens, you can see the Zodiacal associations stream from Ctesc's hand towards the safe. The symbols are: Libra, Ophiuchus, Taurus, Scorpio."
 
The scholar-combo is a readable far-sight. The printed name is "sequence".
The reach-reason is "Ctesc and his hand are out of reach."
The scholar-combo is part of Ch1-Scholar.
Understand "hand", "sequence", "sequence of", "symbol", "symbols", "his", "ctesc's", "ensign's" as the scholar-combo.
 
The description of the scholar-combo is "You squint at Ctesc, but he's too far away and his hand is at an awkward angle. You can't make the symbols out[if the safe-combo-note is not known]. The last one might be... Scorpio? Virgo?[else] -- at least not with the naked eye.[end if]"
 
Check inspecting the scholar-combo with the planetary-lens:
    instead try inspecting Ch1-Scholar with the planetary-lens.
Check inspecting the scholar-combo with the convex-lens:
    instead try inspecting Ch1-Scholar with the convex-lens.
Check inspecting the scholar-combo with the concave-lens:
    instead try inspecting Ch1-Scholar with the concave-lens.
Check inspecting the scholar-combo with the oculus:
    instead try inspecting Ch1-Scholar with the oculus.
 
Ch1-Captain is a female prominent-scenery fracture-blocked character. The persona of Ch1-Captain is Captain.
Ch1-Captain is in the Officer-Hall.
 
The description of Ch1-Captain is "Captain Hart leans her burly frame against the wall. She's eyeing the hallway, as if worried that someone was about to walk by -- which is absurd, of course. The Captain doesn't worry; lowly officers worry about [em]her[/em]."
 
Ch1-Climber is a male prominent-scenery fracture-blocked character. The persona of Ch1-Climber is Climber.
Ch1-Climber is in the Grand-Stair.
 
The description of Ch1-Climber is "You recognize Lieutenant Michael Powes, a thin man with a piercing stare. But why here? You know he's Aithery-file, but a lieutenant wouldn't ordinarily have business in the Birdhouse."
 
[Chapter 2: Homunculus following.]
 
Ch2-Captain is a female prominent-scenery character. The persona of Ch2-Captain is Captain.
The initial appearance of Ch2-Captain is "[meet Ch2-Captain]You see the Captain here. She is still frozen stiff -- caught still while peering around the room."
The description is "Captain Hart is a burly woman with a clean-shaven head and one gold earring. She is looking around with a discontented air."
 
Ch2-Scholar is a male prominent-scenery character. The persona of Ch2-Scholar is Scholar.
The initial appearance of Ch2-Scholar is "[meet Ch2-Scholar]You see Ensign Ctesc here, in the middle of the room, but still unmoving."
The description is "Ensign Ctesc is a round-faced young man who always looks slightly unkempt. He is peering at the doors with unnerving intentness."
 
Ch2-Grafter is a female prominent-scenery character. The persona of Ch2-Grafter is Grafter.
The initial appearance of Ch2-Grafter is "[meet Ch2-Grafter]You see Lt Anderes here -- no longer isolated by any fracture, but still unmoving. Whatever has the [Retort] in its grip, it has not let her go. She seems to be peering at the fracture to the north, as if contemplating the Primary Lab."
The description is "Lt Anderes is a tall, sour-faced officer. She is no longer behind the fracture, but she still seems to be frozen in place."
 
Ch2-Climber is a male prominent-scenery character. The persona of Ch2-Climber is Climber.
The initial appearance of Ch2-Climber is "[meet Ch2-Climber]Lieutenant Powes stands here. His eyes are narrowed, fixed on the flames -- or the door at the far end of the corridor. You have to reassure yourself that he is frozen in place, like the others, and not merely stilled by intense concentration."
The description is "Lt Powes is a thin man with unnervingly sharp eyes. He is looking down the corridor towards the high wing."
 
[Chapter 3: At least one dragon awake]
 
A ch3-character is a kind of character.
 
Check examining a ch3-character:
    say "[em]Your perspective shifts.[/em][para]";
    flip the first aspect of the persona of the noun;
    continue the action.
 
Ch3-Captain is a female prominent-scenery ch3-character. The persona of Ch3-Captain is Captain.
The initial appearance of Ch3-Captain is "[meet Ch3-Captain]The Captain is standing here, gazing moodily off down the hall[if Captain is aspect-positive]. She looks nearly human like this; it's rather charming[else]. The crack in her martial facade is disturbing, and faintly disappointing[end if]."
The description is "The idea of Captain Hart being moody is nigh-incomprehensible[if Captain is aspect-positive]. But you suppose that even a marcher captain can have a human side. Good for her[else]. You suppose that even a marcher captain can have a human side. But it would be irresponsible of her to let it affect the marcher, of course[end if]."
 
Ch3-Scholar is a male prominent-scenery ch3-character. The persona of Ch3-Scholar is Scholar.
The initial appearance of Ch3-Scholar is "[meet Ch3-Scholar]You see Ensign Ctesc standing here[if Scholar is aspect-positive]. His normally placid face is illuminated by eagerness -- an intensity that he does not show to others[else]. His normally placid face is sharpened into expression of feverish avarice[end if]."
The description is "Ensign Ctesc looks toward the books. Clearly he has snuck in here without permission[if Scholar is aspect-positive]. You can understand that, even if he has bent the edges of the rules. You too are on the [Retort] for knowledge[else]. You sense that his desire for knowledge has outstripped his wisdom; he has set foot on some unseen path to self-harm[end if]."
 
Ch3-Grafter is a female prominent-scenery ch3-character. The persona of Ch3-Grafter is Grafter.
The initial appearance of Ch3-Grafter is "[meet Ch3-Grafter]You see Lt Anderes here[if Grafter is aspect-positive]. She is scowling at the shelves -- although, as you recall, she scowls at everything[else]. She is peering at the shelves, her face pinched with greed[end if]."
The description is "Anderes looks toward the shelves. They are her responsibility, of course[if Grafter is aspect-positive]. She may have been keeping a hand in towards her own needs; but then, haven't you been taking a free hand with ship's supplies yourself, recently?[else]. But you sense that she has begun viewing them as her [em]possessions[/em], which is quite a different thing.[end if]".
 
Ch3-Climber is a male prominent-scenery ch3-character. The persona of Ch3-Climber is Climber.
The initial appearance of Ch3-Climber is "[meet Ch3-Climber]You see Lt Powes crouched over a shelf[if Climber is aspect-positive]. His expression is wary, but intent; whatever he is doing, he has no doubts of his aim[else]. His expression is shifty; whatever he is doing, he fears discovery[end if]."
The description is "Lt Powes is searching a shelf of supplies, although he has not yet found his goal[if Climber is aspect-positive]. His aim is clearly covert, but you sense that his target -- whoever that is -- deserves his ire[else]. His aim is clearly covert, and you feel a flash of sympathy for his target -- whoever that is[end if]."
 
[Chapter not-actually-4: Avatar in final position (nested) after it has been resolved.]
 
A ch4-character is a kind of character.
 
Check examining a ch4-character:
    say "[em]Your perspective shifts.[/em][para]";
    flip the second aspect of the persona of the noun;
    continue the action.
 
Ch4-Captain is a female prominent-scenery ch4-character. The persona of Ch4-Captain is Captain.
The initial appearance of Ch4-Captain is "[meet Ch4-Captain]Captain Hart is nearby, standing with her arms crossed and[if Captain is aspect-endorsed] a patient expression on her face[else] an exasperated expression on her face[end if]."
The description is "[Ch4-Captain-desc]".
To say Ch4-Captain-desc:
    if the aspect-text-seen for Captain is 0:
        if Captain is aspect-endorsed:
            say "You're not sure what she's waiting for";
        else:
            say "You're not sure what's bothering her";
    else if Captain is aspect-positive:
        say "The Captain has flung herself into this situation for her own reasons";
        if Captain is aspect-endorsed:
            say ", and you're not about to accuse your superiors of bad judgement";
        else:
            say ". But you wish her timing had been better";
    else:
        say "The Captain has gotten herself into a mess, all right";
        if Captain is aspect-endorsed:
            say ". It makes a romantic story, but a terrible reality";
        else:
            say ". And she may have taken her ship down with her. Wonderful";
    say period.
 
Ch4-Scholar is a male prominent-scenery ch4-character. The persona of Ch4-Scholar is Scholar.
The initial appearance of Ch4-Scholar is "[meet Ch4-Scholar]Ensign Ctesc is leaning against the handrail[if Scholar is aspect-endorsed]. He should not be up here. Of course, neither should you; but Ctesc made it here first, and perhaps for better reasons[else]. He should not be up here; but, of course, neither should you. And trespass is the least of Ctesc's sins[end if]."
The description is "[Ch4-Scholar-desc]".
To say Ch4-Scholar-desc:
    if the aspect-text-seen for Scholar is 0:
        if Scholar is aspect-endorsed:
            say "He looks pleased to be here";
        else:
            say "He looks triumphant";
    else if Scholar is aspect-positive:
        say "Ctesc must have found what he was looking for. You can't help but envy him that";
        if Scholar is aspect-endorsed:
            say ". Whatever crimes he committed along the way, he was reaching for the stars";
        else:
            say ". But you also can't help regretting the tragedy that it has led him into";
    else:
        say "Ctesc must have found what he was hunting for. Young as he was, he clearly would let nothing stand in his way";
        if Scholar is aspect-endorsed:
            say ". You wish he had managed to harness that drive; his selfishness has caused great trouble";
        else:
            say ". You wish, rather selfishly, that his drive had destroyed him before it caused such trouble";
    say period.
 
Ch4-Grafter is a female prominent-scenery ch4-character. The persona of Ch4-Grafter is Grafter.
The initial appearance of Ch4-Grafter is "[meet Ch4-Grafter]Lt Anderes is here, poised as if stepping out of the maze[if Grafter is aspect-endorsed]. Though she is still caught in mid-movement, her stance crackles with energy[else]. Her body is tense, her stance pugnacious[end if]."
The description is "[Ch4-Grafter-desc]".
To say Ch4-Grafter-desc:
    if the aspect-text-seen for Grafter is 0:
        if Grafter is aspect-endorsed:
            say "She looks ready for anything";
        else:
            say "She looks dangerous";
    else if Grafter is aspect-positive:
        say "Lt Anderes and her partners have been a step ahead of the rest of the marcher, this entire journey";
        if Grafter is aspect-endorsed:
            say ". You can't help but be impressed";
        else:
            say ". If only they'd managed to get clear before their thefts spilled over into disaster";
    else:
        say "Lt Anderes and her partners have managed to put the entire marcher at risk";
        if Grafter is aspect-endorsed:
            say ". You're astonished that they could plan so well, and so poorly, at the same time";
        else:
            say ". Well, if the [Retort] is going down, at least they'll be dragged down with you";
    say period.
 
Ch4-Climber is a male prominent-scenery ch4-character. The persona of Ch4-Climber is Climber.
The initial appearance of Ch4-Climber is "[meet Ch4-Climber]Lt Powes is sitting in a corner, back to the wall, arms around his knees[if Climber is aspect-endorsed]. He is staring into the dimness, a narrow smile on his face[else]. He is staring into the dimness, wide-eyed, as if struck by a shock[end if]."
The description is "[Ch4-Climber-desc]".
To say Ch4-Climber-desc:
    if the aspect-text-seen for Climber is 0:
        if Climber is aspect-endorsed:
            say "He looks tense";
        else:
            say "He looks overwhelmed";
    else if Climber is aspect-positive:
        say "Powes has the look of a man whose plans are launched and cannot be called back";
        if Climber is aspect-endorsed:
            say ". He has committed himself to someone's downfall. You wish him luck in making some profit from it";
        else:
            say ". He has committed himself to someone's downfall. You hope that whatever he gains is worth the inevitable cost";
    else:
        say "Powes has the look of a man whose plans are moving out of his control";
        if Climber is aspect-endorsed:
            say ". He has committed himself to someone's destruction. Did he know what he was doing, when he began? But it's too late now for him to change course";
        else:
            say ". He has committed himself to someone's destruction. You sense that it was only a game to him, up until this moment. Well, let him stew in the reality";
    say period.
 
Chapter - Dragon Mechanics
 
A dragon is a kind of thing.
A dragon is usually recallable. A dragon is usually ever-seen.
A dragon is usually fixed in place. A dragon is always readable.
A dragon has some text called the short-description. The short-description of a dragon is usually "on the wall".
A dragon can be shifted. [We've ever seen it move. Not resettable.]
Understand "dragon", "mandala", "dragon-mandala", "circles", "circles of", "alchemical", "rune", "runes", "runic" as a dragon.
 
A dragon can be asleep, active, or dead. A dragon is usually asleep.
Definition: a dragon is fixed if it is not asleep.
A dragon can be seen-never, seen-asleep, seen-active, or seen-dead. A dragon is usually seen-never. [This follows asleep/active/dead but only when you see it that way.]
A dragon has a room called the home. [Same as the starting location, really.]
A dragon has a persona. [The character controlled by the dragon's sacrifice.]
 
The verb to live at (it lives at, they live at, it is living at) implies the home property.
 
[No-dragon should be the default value, but it's not.]
The no-dragon is a dragon.
The home is the Abstraction Layer.
The no-dragon is not recallable. The no-dragon is not ever-seen.
 
The dragon-first-seen is a dragon that varies. The dragon-first-seen is no-dragon.
The active-dragon is a dragon that varies. [Active-dragon is no-dragon.]
The dead-dragon-count is a number that varies. Dead-dragon-count is zero.
The syn-gap-doors-fixed is a truth state that varies. Syn-gap-doors-fixed is false.
 
The active-dragon variable translates into I6 as "active_dragon".
Include (-
Global active_dragon = (+ no-dragon +);
-) after "Global Variables" in "Output.i6t".
 
To update the seen-condition for (D - dragon):
    if dragon-first-seen is no-dragon:
        now dragon-first-seen is D;
    [Probably can't ever happen for dead, but whatever.]
    if D is asleep:
        now D is seen-asleep;
    else if D is active:
        now D is seen-active;
    else if D is dead:
        now D is seen-dead.
 
To initially wake (D - dragon):
    if active-dragon is not no-dragon:
        say "(BUG) Tried to initially wake [D], but [active-dragon] is active.";
        stop;
    now the follower is no-thing;
    now the motility of the homunculus is zero;
    now the senility of the homunculus is zero;
    now the homunculus is off-stage;
    now the home-location of the sh-launch-def is the Nave;
    complete tertiary avatars;
    now D is active;
    now active-dragon is D.
 
To decide what dragon is the current-mobile-dragon:
    if active-dragon is no-dragon:
        decide on no-dragon;
    if the follower is no-thing:
        decide on no-dragon;
    decide on the follower.
 
To mobilize active dragon dir (seq - formula):
    if active-dragon is no-dragon:
        say "(BUG) Cannot mobilize active dragon because there is none.";
        stop;
    if the follower is not no-thing:
        say "(BUG) Cannot mobilize active dragon because follower is [follower].";
        stop;
    now the sequence-used of fulcrum-inscription is seq;
    now the senility of fulcrum-inscription is zero;
    now the follower is active-dragon.
 
To wake (D1 - dragon) from (D2 - dragon):
    if active-dragon is no-dragon:
        say "(BUG) Tried to wake [D1] from [D2], but no dragon is active.";
        stop;
    if D1 is not active and D2 is not active:
        say "(BUG) Tried to wake [D1] from [D2], but neither is active.";
        stop;
    if D1 is active and D2 is active:
        say "(BUG) Tried to wake [D1] from [D2], but both are active.";
        stop;
    if D1 is dead:
        say "(BUG) Tried to wake [D1] from [D2], but [D1] is dead.";
        stop;
    if D2 is dead:
        say "(BUG) Tried to wake [D1] from [D2], but [D2] is dead.";
        stop;
    let P1 be the persona of D1;
    let P2 be the persona of D2;
    if D1 is active:
        [the forwards case: D1 remains active]
        now D2 is dead;
        increment dead-dragon-count;
        resolve story of P2 towards P1;
        complete final avatar of P2;
    else:
        [the backwards case: D1 becomes active]
        now D2 is dead;
        increment dead-dragon-count;
        resolve story of P2 towards P1;
        complete final avatar of P2;
        now D1 is active;
        now active-dragon is D1;
 
Reset rule (this is the reset dragon positions rule):
    if Pneuma is not dead:
        now Pneuma is in the home of Pneuma;
    else:
        now Pneuma is off-stage;
    if Baros is not dead:
        now Baros is in the home of Baros;
    else:
        now Baros is off-stage;
    if Aistheta is not dead:
        now Aistheta is in the home of Aistheta;
    else:
        now Aistheta is off-stage;
    if Syndesis is not dead:
        now Syndesis is in the home of Syndesis;
    else:
        now Syndesis is off-stage;
    [once a dragon is active, reset always blanks the follower]
    if chapter-2-done:
        now the follower is no-thing;
    [reset the homunculus as well]
    if chapter-1-done and not chapter-2-done:
        if the follower is not the homunculus:
            say "(BUG) Chapter 1 in progress, but follower not set.";
        now the motility of the homunculus is zero;
        now the senility of the homunculus is zero;
        now the homunculus is in the Nave;
    else:
        if the follower is not no-thing:
            say "(BUG) Chapter 1 not progress, but follower is set.";
        now the motility of the homunculus is zero;
        now the senility of the homunculus is zero;
        now the homunculus is off-stage;
    [deal with the syn-gap doors, too]
    if Syndesis is fixed:
        if syn-gap-doors-fixed is false:
            now syn-gap-doors-fixed is true;
            now real-opt-door is present;
            now real-arms-door is present;
            now real-door-SW is present;
            now real-door-SE is present;
            now real-opt-door is ever-seen;
            now real-arms-door is ever-seen;
            now real-door-SW is ever-seen;
            now real-door-SE is ever-seen;
            now all syn-gap-doors are off-stage;
            now fake-door-SW is off-stage;
            now fake-door-SE is off-stage;
    else:
        if syn-gap-doors-fixed is true:
            say "(BUG) Syndesis has come unfixed and the doors are hosed."
 
Last reset rule (this is the reset sanity-checking dragons rule):
    sanity-check dragons.
 
To sanity-check dragons: (- SanityCheckDragons(); -).
 
Include (-
[ SanityCheckDragons  dra stat numdead numasleep numactive;
    objectloop (dra ofclass (+ dragon +) ) {
        if (dra == (+ no-dragon +) )
            continue;
        stat = GProperty(OBJECT_TY, dra, (+ dragon condition +) );
        ! 1=asleep, 2=active, 3=dead -- not guaranteed, but good enough for testing
        if (dra == (+ active-dragon +) && stat ~= 2)
            print "(BUG) SanityCheckDragons: ", (object) dra, " is active-dragon but has stat ", stat, ".^";
        if (stat == 1)
            numasleep++;
        if (stat == 2) {
            numactive++;
            if (dra ~= (+ active-dragon +) )
                print "(BUG) SanityCheckDragons: ", (object) dra, " has stat active but is not active-dragon.^";
        }
        if (stat == 3)
            numdead++;
    }
    if ( (+ active-dragon +) == (+ no-dragon +) ) {
        if (numactive)
            print "(BUG) SanityCheckDragons: pre-2, but ", numactive, " dragons active.^";
        if (numdead)
            print "(BUG) SanityCheckDragons: pre-2, but ", numdead, " dragons dead.^";
    }
    else {
        if (numactive ~= 1)
            print "(BUG) SanityCheckDragons: ", numactive, " dragons active (should be 1).^";
    }
    if (numdead ~= (+ dead-dragon-count +) )
        print "(BUG) SanityCheckDragons: ", numdead, " dragons dead (should be ", (+ dead-dragon-count +), ").^";
];
-).
 
Section - Rules for Dragons
 
Rule for writing a paragraph about a dragon (called D):
    let known-active be whether or not D is seen-active;
    update the seen-condition for D;
    if D is in the home of D:
        say "The dragon [D] is a mandala of alchemical runes [short-description of D]";
        if D is asleep:
            if not chapter-2-done:
                if D is the dragon-first-seen:
                    say ". But the runes look [one of]unexpectedly lifeless[or]lifeless and inert[stopping]";
                else:
                    say ". This one, too, looks lifeless and inert";
            else:
                [chapter 3 and up]
                say ". They still look lifeless and inert";
        if D is active:
            say ". The circles rotate majestically, shining with [color of D] radiance";
            if dead-dragon-count is not zero:
                say " (and hints of ";
                begin cheap list for dead-dragon-count;
                repeat with D2 running through dead dragons:
                    say cheap list D2 with "[color of substitution-variable]";
                end cheap list;
                say ")";
            if known-active is false:
                if dead-dragon-count is 0:
                    say ".[para]The dragon has wakened! The presence of the the scribble must have... you do not know what, but [em]something[/em] occurred in that moment";
                else:
                    say ". The dragon has wakened";
        instead say ".";
    else:
        if D is not active:
            instead say "(BUG) [D] is mobile but not active.";
        say "[The D] -- a [color of D]";
        if dead-dragon-count is not zero:
            say " mandala, chased with ";
            begin cheap list for dead-dragon-count;
            repeat with D2 running through dead dragons:
                say cheap list D2 with "[color of substitution-variable]";
            end cheap list;
        else:
            say " runic mandala";
        say " -- [follower-locale for location]";
        instead say ".";
 
Check examining a dragon (called D):
    update the seen-condition for D;
    if D is asleep:
        say "Circles of grey-glimmering runes";
    else if D is active:
        say "Orbiting circles of [color of D] runes";
        if dead-dragon-count is not zero:
            say ", underlaid with ";
            begin cheap list for dead-dragon-count;
            repeat with D2 running through dead dragons:
                say cheap list D2 with "[color of substitution-variable]";
            end cheap list;
            say ",";
    else:
        say "(BUG) Circles of dead runes";
    if D is in the home of D:
        say " [dragon-short-locale of D]";
    else:
        say " are visible here";
    say ". This is [the D], one of the marcher's four dragons";
    if D is in the home of D:
        say ". ";
    else:
        say " -- now dislocated from its nest.[para]";
    say "[The D] is responsible for [dragon-responsibility of D]";
    if D is asleep:
        say ".[para]Something is wrong, however. [if the visited-dragon-count is 1]You've never seen a dragon before, but by[else]By[end if] all accounts, the circles of runes should be rotating, eternally reading themselves. The color is wrong too. [The D] can't be dead (or [failure-mode of D]), but it clearly isn't working correctly";
        mark dragon-lecture-note as known;
        if dragon-lecture-note is not ever-used:
            say ".[para]You wrack your brains, trying to recall the Sergeant's lecture on the theory of dragons";
    instead say "."
 
Check taking a dragon:
    instead say "The dragon is runes on the wall. You can't pick it up."
 
Check turning a dragon:
    if the noun is asleep:
        instead say "If the dragon were functional, it would turn itself.";
    instead say "It's already turning."
 
Check touching a dragon:
    instead say "You can feel no texture of ink or paint on the runes."
 
Check rubbing a dragon:
    instead say "The runes do not smear or fade, no matter how hard you rub them."
 
Check tapping the dispersal-brush on a dragon:
    retire the dispersal-brush by manual destruction in the second noun;
    instead say "The moment the feather touches the runes, it crackles and falls to dust. Whoops. The dragon is entirely unaffected."
 
Check putting the dispersal-brush on a dragon:
    instead try tapping the dispersal-brush on the second noun.
 
Check repairing a dragon:
    if the noun is asleep:
        if dead-dragon-count is not zero:
            instead say "The subsumption trick has worked before.";
        if active-dragon is not no-dragon:
            instead say "The homunculus is gone.";
        instead say "You have no idea how to fix this.";
    instead say "The dragon seems to be functional now."
 
Check freeing a dragon:
    instead say "A dragon isn't an imprisoned creature; it's a ritual tool."
 
Check inspecting a dragon with the planetary-lens:
    instead say "You peer at [the noun] through the lens, but you don't perceive any planetary association at all. It makes sense, you suppose. The dragon is the marcher, and the marcher can never be associated with any single planet."
 
Check inspecting a dragon with the oculus:
    say "The oculus reveals [the noun] as a web of occult relations running throughout the [Retort]";
    if the noun is dead:
        instead say ". (BUG) It's dead, so you shouldn't be able to inspect it.";
    if the noun is asleep:
        say ". It doesn't look good";
    else:
        say ". It looks healthy now";
    say ".[para]";
    say dragon-oculus-analysis of the noun;
    if the noun is active and dead-dragon-count is not zero:
        say "[br][The noun] has absorbed [the list of dead dragons]; you can see [if dead-dragon-count is 1]its associations[else]their associations[end if] as well. These include ";
        let index be zero;
        repeat with D2 running through dead dragons:
            if index is not zero:
                say "; ";
            say dragon-oculus-short-active of D2;
            increment index;
        say ".";
    stop the action.
 
Carry out recalling a recallable dragon:
    if the noun is the follower:
        if the noun is in the location:
            say "[The noun] is right here, following you";
        else:
            say "You're not sure where [the noun] is right now";
        say ".[para][The noun] is responsible for [dragon-responsibility of noun]";
        if the noun is active and dead-dragon-count is not zero:
            say ". It has also absorbed [the list of dead dragons]";
        instead say ".";
    if the noun is off-stage:
        say "[The noun] was responsible for [dragon-responsibility of noun].[para]";
        instead say "[The noun] is gone. Its function has been absorbed by [the active-dragon].";
    if the home of the noun is not the location of the noun:
        instead say "(BUG) [Noun] is not at home.";
    let R be the home of the noun;
    if R is not visited:
        [No recall information in this case.]
        instead say "You have never been to [refer-name of R], where [the noun] lives.";
    say "[The noun] is responsible for [dragon-responsibility of noun]";
    if the noun is active and dead-dragon-count is not zero:
        say ". It has also absorbed [the list of dead dragons]";
    say ".[para]";
    say "[The noun] is [if R is the location]here, [end if][refer-preposition of R] [refer-name of R]";
    if the noun is not in the location:
        if noun is seen-asleep:
            say ". Last you saw, something was wrong with it";
        else if noun is seen-active:
            say ". Last you saw, it was fully functional";
    instead say "."
 
Check visiting a dragon:
    if the noun is the follower:
        if the noun is in the location:
            instead say "[The noun] is right here.";
        else:
            instead say "You're not sure where [the noun] is right now.";
    if the noun is off-stage:
        instead say "[The noun] is gone."; [### display sacrifice history?]
    if the home of the noun is not the location of the noun:
        instead say "(BUG) [Noun] is not at home.";
    let R be the home of the noun;
    if R is not visited:
        instead say "You have never been to [refer-name of R], where [the noun] lives.";
    continue the action.
 
Check creating an off-stage dragon:
    instead say "You do not know how to create a dragon."
 
Carry out invoking the calyx-pattern when a dragon (called D) is in the location:
    if an active dragon (called D2) is in the location:
        [If there are *two* local dragons, pick the active one.]
        now D is D2;
    if D is not active:
        instead say "You run through the [em]calyx access[/em] sequence in your head. [The D]'s runes seem to quiver in response, but there is no other effect.";
    say "You run through the [em]calyx access[/em] sequence in your head";
    if dead-dragon-count is:
        -- 0:
            instead say ". [D]'s runes quiver in response, and you suddenly sense [dragon-resposummary-long for D]. The dragon does not respond to your presence, however.";
        -- 1:
            instead say ". [D]'s runes quiver in response. You suddenly sense [dragon-resposummary-long for D], along with [dead-dragon-short-resposummary-list].[para]The dragon is reaching out, trying to assess the damage to the [Retort], but you can tell that it lacks the capacity. It seems only dimly aware of your presence.";
        -- 2:
            let D3 be a random recallable asleep dragon; ["recallable" excludes no-dragon]
            instead say ". [D]'s runes quiver in response. You suddenly sense [dragon-resposummary-long for D], along with [dead-dragon-short-resposummary-list].[para]The dragon is attempting to bring the [Retort] back to some semblance of wholeness. A thought flows in your direction: 'Unable to contact [the D3]. Please advise. Please advise.'";
        -- 3:
            say ". [D]'s runes quiver in response. You have a sudden sense of the [Retort's] operation: [dragon-resposummary-long for D], [dead-dragon-short-resposummary-list]";
            say ".[para]A thought flows from the dragon to you: 'Marcher systems are alive; transition may now be possible. Please attempt reanimation procedure in the Chancel. Extended status report via memory dump[if the location is the home of D], this location[else], dragon nest location[end if].'";
            let appeared be false;
            if the sh-status-report is not in the home of D:
                now the sh-status-report is in the home of D;
                now appeared is true;
            if the player is in the home of D:
                now local-memspark is sh-status-report; [sorry]
                now notice-memspark-flag is false;
                if the player carries the oculus:
                    now sh-status-report is prominent-scenery;
                    say "[br]You catch a glint of light in the oculus[if appeared is true]. You're pretty sure it wasn't there before[end if].[br]";
                else:
                    if appeared is true:
                        say "[br]You sense... something... radiating from the dragon, although you can't see anything.[br]";
            stop the action;
    instead say ". (BUG) Calyx response for [D], count [dead-dragon-count]."
 
To say dead-dragon-short-resposummary-list:
    [We don't use cheap list here because I want only commas, not "and".]
    let comma be "";
    repeat with D running through dead dragons:
        say "[comma][dragon-resposummary-short for D]";
        now comma is ", ".
 
Section - Specific Dragons and Details
 
To decide what number is the visited-dragon-count:
    let N be zero;
    if the home of Pneuma is visited, increment N;
    if the home of Aistheta is visited, increment N;
    if the home of Baros is visited, increment N;
    if the home of Syndesis is visited, increment N;
    decide on N.
 
Definition: a room is dragon-nested if it is the Garden-Maze-Center or it is the Aithery or it is the Barosy or it is the Birdhouse.
 
Pneuma is a dragon.
The home is the Garden-Maze-Center.
The persona of Pneuma is Grafter.
 
Aistheta is a dragon.
The home is the Aithery.
The persona of Aistheta is Scholar.
 
Baros is a dragon.
The home is the Barosy.
The persona of Baros is Climber.
 
Syndesis is a dragon.
The home is the Birdhouse.
The persona of Syndesis is Captain.
 
To say color of (D - dragon) (this is dragon-color-saying):
    if D is:
        -- Baros: say "brown-gold";
        -- Pneuma: say "sea-green";
        -- Aistheta: say "yellow-white";
        -- Syndesis: say "violet-red";
        -- otherwise: say "(BUG) color".
 
To say failure-mode of (D - dragon):
    if D is:
        -- Baros: say "you'd be floating off the floor";
        -- Pneuma: say "you'd be suffocating in the dark";
        -- Aistheta: say "you'd be hopelessly lost";
        -- Syndesis: say "you'd be stuck in a doorless room";
        -- otherwise: say "(BUG) failure mode".
 
To say dragon-short-locale of (D - dragon):
    if D is:
        -- Baros: say "cover a wall of the Barosy";
        -- Pneuma: say "cover the inner screens";
        -- Aistheta: say "hang on the dome";
        -- Syndesis: say "hang on the Birdhouse wall";
        -- otherwise: say "(BUG) dragon-short-locale".
 
[This is used when recalling or examining.]
To say dragon-responsibility of (D - dragon):
    if D is:
        -- Baros: say "gravity, stability, and orientation within the [Retort]";
        -- Pneuma: say "light, warmth, and the flow of air";
        -- Aistheta: say "awareness of the [Retort's] location and environment";
        -- Syndesis: say "the [Retort's] travel between worlds and its coherence within itself";
        -- otherwise: say "(BUG) dragon-responsibility".
 
[These two are used when calyxing.]
To say dragon-resposummary-short for (D - dragon):
    if D is:
        -- Pneuma: say "air and light";
        -- Baros: say "weight and gravity";
        -- Aistheta: say "structure and position";
        -- Syndesis: say "coherence and integrity";
        -- otherwise: say "(BUG)";
To say dragon-resposummary-long for (D - dragon):
    if D is:
        -- Pneuma: say "the routine balancing of air and light";
        -- Baros: say "the routine balancing of weight and gravity";
        -- Aistheta: say "the routine maintenance of structure and position";
        -- Syndesis: say "the routine maintenance of coherence and integrity";
        -- otherwise: say "(BUG)";
 
To say dragon-oculus-analysis of (D - dragon):
    if D is not fixed:
        if D is:
            -- Baros: say "A curved net of gravity lies beneath the entire marcher. It looks patchy and unstable. The crawlway beneath the garden and Barosy is particularly knotted, and the south end of the chasm is oscillating.";
            -- Pneuma: say "Sophic lanterns are everywhere, of course, drawing meager streams of phlogiston. Deep beneath the marcher, the nexus points that supply air and warmth all seem healthy. However, the control paths that rise to the marcher proper are another matter. The air-pumps in the airlock and exoscaphe bay have no power at all.";
            -- Aistheta: say "The compass-rule lines throughout the marcher are weak. They are mostly aligned with the architecture, providing your familiar sense of direction. But where the passages twist -- the garden maze, the cracks by the chasm -- the compass lines are snarled and useless.";
            -- Syndesis: say "The architecture of the marcher is full of holes. The worst are by the secondary alchemy lab, the chymic lab, the opticks lab, and the deck suite.";
            -- otherwise: say "(BUG) dragon-oculus-analysis.";
    else:
        if D is:
            -- Baros: say "A curved net of gravity lies beneath the entire marcher. The weave is regular now, although you can see recent repairs in the chasm and in the crawlway beneath the garden and Barosy.";
            -- Pneuma: say "Sophic lanterns are everywhere, of course, drawing phlogiston. Deep beneath the marcher, the nexus points that supply air and warmth all seem strong. Control paths rise from these to the air-pumps in the airlock and exoscaphe bay.";
            -- Aistheta: say "The compass-rule lines throughout the marcher are firmly drawn, providing your familiar sense of direction. The garden maze and the cracks by the chasm have been pulled back into alignment.";
            -- Syndesis: say "The architecture of the marcher is still somewhat fractured. But you can see patches covering the worst holes -- by the secondary alchemy lab, the chymic lab, the opticks lab, and the deck suite.";
            -- otherwise: say "(BUG) dragon-oculus-analysis.";
 
To say dragon-oculus-short-active of (D - dragon):
    if D is:
        -- Baros: say "stabilization in the chasm and in the crawlway beneath the garden and Barosy";
        -- Pneuma: say "active control paths to the air-pumps in the airlock and exoscaphe bay";
        -- Aistheta: say "alignment repairs in the garden maze and the cracks by the chasm";
        -- Syndesis: say "patches by the secondary alchemy lab, the chymic lab, the opticks lab, and the deck suite";
        -- otherwise: say "(BUG) dragon-oculus-short-active.";
 
 
Chapter - The Followers
 
The follower is a thing that varies. The follower is no-thing.
 
A room can be follower-enabled or follower-disabled. A room is usually follower-disabled.
A wallpaper-enabled room is usually follower-enabled. [Covers a lot of cases.]
The Nave is follower-enabled.
The 2nd-Lab, the Mech-Lab, the Mech-Store, the Herbarium, the Chem-Lab are follower-enabled.
The Opt-Lab, the Opt-Store, the Opt-Closet, the Fire-Lab, the Fire-Store, Safe-Store, the Safe-Nook, the Library, the 3rd-Lab are follower-enabled.
The Portico, the Med-Wing, the Med-Lab, the Scaphe-View, the Scaphe-View-North, the Dressing-Room are follower-enabled.
The Under-Ward, the Study-Room, the Junior-Quarters, the Deck-Suite, the Captain-Quarters, the Rector-Quarters, the Arms-Quarters are follower-enabled.
The Garden, the Garden-Maze-Lost, the Garden-Maze-Center, the Observatory, the Obs-Nook, the Aithery, the Grand-Stair, the Birdhouse, the Basement, the Barosy are follower-enabled.
The Charred-Hall, the Charred-End, the Antechamber are follower-enabled.
[Exclude the crawlways, the chancel, the exoscaphe, the airlock, the chasm zone, and anything outdoors.]
 
[Rooms where the follower is on the ceiling, out of reach.]
Definition: a room is follower-untouchable if it is the Nave or it is the Observatory.
 
[Rooms where the follower has to sneak in because there are no adjacent follower-enabled rooms.]
Definition: a room (called R) is follower-isolated if R is the Herbarium or (Syndesis is not fixed and (R is the Chem-Lab or R is the 2nd-Lab)).
 
To say follower-locale for (R - room):
    if R is:
        -- the Herbarium: say "glows at the back of the nook";
        -- the Safe-Nook: say "glows at the back of the nook";
        -- the Nave: say "shines on the ceiling"; [out of reach]
        -- the Scaphe-View: say "shines on the brick wall";
        -- the Scaphe-View-North: say "shines on the brick wall";
        -- the Garden: say "shines on the tree-hung wall";
        -- the Garden-Maze-Lost: say "shines on one of the screens";
        -- the Garden-Maze-Center: say "shines on one of the screens";
        -- the Observatory: say "shines near the edge of the dome"; [out of reach]
        -- the Obs-Nook: say "glows on the alcove wall";
        -- the Aithery: say "shines on the dome";
        -- the Basement: say "glows on the tile";
        -- the Barosy: say "shines on one slab";
        -- the Charred-End: say "glows on an ashy wall";
        -- otherwise:
            if R is wallpaper-enabled:
                say "shines on the wallpaper";
            else:
                say "shines on one wall".
 
To say homunculus-extra-locale for (R - room) para (paraflag - truth state):
    if the location is:
        -- the Lab-Hall-NW: say ". It seems to be staying clear of the black marks";
        -- the Garden: say ". It appears to be attracted towards the maze entrance";
        -- the Observatory: say ". It appears to be attracted towards the upper-level bridge";
        -- the Basement: say ". It appears to be attracted towards the iron gate, and to avoid the black marks";
        -- the Grand-Stair: say ". It appears to be attracted towards the engraved door";
        -- otherwise: stop;
    if paraflag is true:
        say ".[para]Odd";
 
To say homunculus-extra-arrival for (R - room):
    if the location is:
        -- the Lab-Hall-NW: say ". It seems to avoid the black marks";
        -- the Garden: say ". It is slightly distorted, tilted towards the arch";
        -- the Observatory: say ". It is slightly distorted, stretched upwards";
        -- the Basement: say ". It is slightly distorted in the direction of the iron gate";
        -- the Grand-Stair: say ". It is slightly distorted in the direction of the engraved door";
        [the following locations are determined by the ch2-character locations in the complete initial marriage routine.]
        -- Lab-Wing-Hall: say ".[para]The scribble slides past the Lieutenant's frozen form. As it does, you hear her voice: [character vocalization for Grafter][homunculus-extra-arrival-gloss for Grafter]";
        -- Charred-Hall: say ".[para]The scribble slides past the Lieutenant's frozen form. As it does, you hear his voice: [character vocalization for Climber][homunculus-extra-arrival-gloss for Climber]";
        -- Scaphe-View: say ".[para]The scribble slides past the Captain's frozen form. As it does, you hear her voice: [character vocalization for Captain][homunculus-extra-arrival-gloss for Captain]";
        -- Deck-Suite: say ".[para]The scribble slides past the Ensign's frozen form. As it does, you hear his voice: [character vocalization for Scholar][homunculus-extra-arrival-gloss for Scholar]";
        -- otherwise:
            if the location is dragon-nested:
                say ". It doesn't quite stabilize, this time. It seems to be drifting slowly towards the dragon-mandala";
 
To say dragon-extra-arrival for (R - room):
    [We've already covered the "coming home" and "hitting fulcrum" cases, so this isn't those.]
    if Ch3-Captain is in the location:
         say ".[para]The dragon slides past the Captain's frozen form. As it does, you hear her voice: [character vocalization for Captain][homunculus-extra-arrival-gloss for Captain]";
    else if Ch3-Grafter is in the location:
         say ".[para]The dragon slides past the Lieutenant's frozen form. As it does, you hear her voice: [character vocalization for Grafter][homunculus-extra-arrival-gloss for Grafter]";
    else if Ch3-Climber is in the location:
         say ".[para]The dragon slides past the Lieutenant's frozen form. As it does, you hear his voice: [character vocalization for Climber][homunculus-extra-arrival-gloss for Climber]";
    else if Ch3-Scholar is in the location:
         say ".[para]The dragon slides past the Ensign's frozen form. As it does, you hear his voice: [character vocalization for Scholar][homunculus-extra-arrival-gloss for Scholar]";
    else if Ch4-Captain is in the location:
         say ".[para]The dragon slides past the Captain's frozen form. As it does, you hear her voice: [final character vocalization for Captain] She has not moved";
    else if Ch4-Grafter is in the location:
         say ".[para]The dragon slides past the Lieutenant's frozen form. As it does, you hear her voice: [final character vocalization for Grafter] She has not moved";
    else if Ch4-Climber is in the location:
         say ".[para]The dragon slides past the Lieutenant's frozen form. As it does, you hear his voice: [final character vocalization for Climber] He has not moved";
    else if Ch4-Scholar is in the location:
         say ".[para]The dragon slides past the Ensign's frozen form. As it does, you hear his voice: [final character vocalization for Scholar] He has not moved";
 
To say homunculus-extra-arrival-gloss for (P - persona):
    say "[one of][para]You peer at [P]. No, [he-she P] has not moved, not even [his-her P] lips. But the words echo in your ears nonetheless[or] But [he-she P] has not moved[stopping]";
 
[Yes, this every-turn rule is a mess.]
[In general we will move the follower off-stage when the player is in a follower-disabled area.]
 
Every turn when the follower is not no-thing (this is the follower following rule):
    if the location is a reset-room:
        [Nothing follows you in here; no message is displayed.]
        continue the action;
    if the follower is the homunculus and the location is the Nave-Crawl:
        [This is a special case. It doesn't follow you in, but no messages are displayed either. Motility is unchanged; could be motile or not at this point.]
        now the homunculus is in the Nave;
        now the senility of the homunculus is zero;
        continue the action;
    if the follower is the homunculus and the homunculus is not motile:
        if the location is the Nave:
            increment the motility of the homunculus;
            if the motility of the homunculus is 1:
                do nothing;
            else if the homunculus is not motile:
                say "The scribble seems to have changed position slightly.";
            else:
                say "The scribble shifts slowly across the ceiling.";
        else:
            [It quiets down rather than following you out of the Nave.]
            now the motility of the homunculus is zero;
            now the senility of the homunculus is zero;
            now the homunculus is in the Nave;
        continue the action;
    if the location is follower-disabled:
        if the follower is off-stage:
            do nothing;
        else:
            now the follower is off-stage;
            now the follower is shifted;
            say "You no longer see [the follower].";
        continue the action;
    if the follower is a dragon and the current-fulcrum is in the location:
        now the follower is in the location;
        now the follower is shifted;
        let T be the current-fulcrum;
        say "[The follower] drifts into the room.[para]Sudden electricity arcs between the dragon and the glowing [T]! The runes whirl out of control; the pebble goes dark; and -- oh dear -- everything else goes dark as well.";
        invoke reset;
        continue the action;
    if the follower is a dragon and the location is the home of the follower:
        now the follower is in the location;
        now the follower is shifted;
        say "[The follower] drifts into the room. It whirls contemplatively, and then settles back into its original location.";
        now the sequence-used of fulcrum-inscription is no-word;
        now the senility of fulcrum-inscription is zero;
        now the follower is no-thing;
        continue the action;
    [End of special cases.]
    if the follower is not in the location:
        [No special message for moving it in from off-stage.]
        let was-shifted be whether or not the follower is shifted;
        now the follower is in the location;
        now the follower is shifted;
        if the location is follower-isolated:
            say "[The follower] drifts in through a wall";
        else if the follower is the homunculus and a random chance of 1 in 5 succeeds:
            say "The silver scribble [homunculus-shape-gait] [one of]into the room[or]in[or]in along a wall[at random]";
        else if the follower is a dragon and was-shifted is false:
            [We'll only get this once per dragon, and it really should be once per summoning. But whatever.]
            say "Whirling [color of follower] runes slide into the Nave from the western hallway. You recognize the dragon [follower], come in answer to your summons.[para]The mandala drifts across the murals and settles on the ceiling";
        else:
            say "[The follower] [one of]drifts into the room[or]slides into the room behind you[or]arrives a moment later[or]slides in along the wall[or]silently arrives[at random]";
        if the follower is the homunculus:
            now the senility of the homunculus is zero;
            say homunculus-extra-arrival for location;
        if the follower is a dragon:
            now the senility of the fulcrum-inscription is zero;
            say dragon-extra-arrival for location;
        say ".";
    else:
        [Standing around with follower present (after arrival)]
        if the follower is the homunculus:
            if the location is not dragon-nested:
                now the senility of the homunculus is zero;
            else:
                unless a dragon (called D) lives at the location:
                    say "(BUG) In [location], but no dragon lives here.";
                else:
                    increment senility of the homunculus;
                    if the senility of the homunculus <= 1:
                        say "The scribble is drawn towards [the D] like a bubble to a drain.";
                    else:
                        say "The scribble spirals around [the D] -- inward -- inward --[para]The mandala flares with [color of D] light, and it is blinding.[para]You hear the aroma of copal incense; smell the texture of shattering glass.";
                        initially wake D;
                        invoke reset;
                        continue the action;
        if the follower is a dragon:
            if the location is not dragon-nested:
                now the senility of the fulcrum-inscription is zero;
            else:
                unless a dragon (called D) lives at the location:
                    say "(BUG) In [location], but no dragon lives here.";
                else if D is not asleep:
                    now the senility of the fulcrum-inscription is zero;
                else if D is the follower:
                    now the senility of the fulcrum-inscription is zero;
                else:
                    increment senility of the fulcrum-inscription;
                    if the senility of the fulcrum-inscription <= 1:
                        say "[The follower] is being drawn towards [the D].";
                    else if the current-fulcrum is no-thing:
                        say "(BUG) You have a dragon meeting, but no fulcrum.";
                    else:
                        say "[The follower] slides towards [the D], faster and faster";
                        now the glyph-used of fulcrum-inscription is consumed;
                        if the sequence-used of the fulcrum-inscription is the symmetric sequence:
                            say ". At the last moment, [the D] seems to crumple, break apart, and be drawn into the [color of follower] heart of [the follower]";
                            wake the follower from D;
                        else:
                            say ". At the last moment, [the follower] seems to crumple, break apart, and fly into the heart of [the D] -- which flares to [color of D] life";
                            wake D from the follower;
                        say ".[para]You hear, smell, see a confusion of smells and sounds and colored light.";
                        invoke reset;
                        continue the action;
 
 
Every turn (this is the fulcrum glowing rule):
    let T be the current-fulcrum;
    if T is not no-thing:
        if the location is not a reset-room:
            let R be the location of T;
            if R is dragon-nested:
                if the fulcrum-inscription is unlit:
                    now the fulcrum-inscription is lit;
                    if the player is in R:
                        say "As you enter, [the T] begins to shine with a silvery light.";
            else:
                if the fulcrum-inscription is lit:
                    now the fulcrum-inscription is unlit;
                    if the player is in R:
                        say "[The T] is no longer glowing.";
 
Every turn (this is the ballast glowing rule):
    if the brass-pin symbol-matches fixation-symbol:
        if the location is not a reset-room:
            let R be the location of the brass-pin;
            if R is ballast-appropriate:
                if the fixit-brass-inscription is unlit:
                    now the fixit-brass-inscription is lit;
                    if the player is in R:
                        say "As you enter, [the brass-pin] acquires a hazy glow.";
            else:
                if the fixit-brass-inscription is lit:
                    now the fixit-brass-inscription is unlit;
                    if the player is in R:
                        say "[The brass-pin] is no longer glowing.";
 
 
Section - The Homunculus
 
The homunculus is a low-locale-priority prominent-scenery recallable thing. The printed name is "scribble".
The homunculus has a number called the motility. [0: frozen in the Nave. 1, 2: stirring in the Nave. 3: following. (Resettable.)]
The homunculus has a number called the senility. [0: not near a dragon. 1: drifting towards a dragon. 2: done.]
The homunculus can be shifted. [We've ever seen it move. Not resettable.]
The homunculus has a number called the mem-state. The mem-state of the homunculus is 0.
Understand "homuncula", "scribble", "scrawl", "silvery", "silver", "lines", "graffiti", "random", "chaotic", "chaos", "dense", "cluster", "outline", "humanoid" as the homunculus.
 
Definition: the homunculus is motile if the motility of the homunculus >= 3.
 
To bump the homunculus-shape:
    let M be the mem-state of the homunculus;
    let N be a random number between 0 and 9;
    if M is N:
        increment N;
        if N > 9:
            now N is 0;
    now the the mem-state of the homunculus is N;
 
To say homunculus-shape-desc:
    if the mem-state of the homunculus is:
        -- 0: say "humanoid";
        -- 1: say "mousey";
        -- 2: say "cat-like";
        -- 3: say "dog-like";
        -- 4: say "horse-shaped";
        -- 5: say "turtle-shaped";
        -- 6: say "fish-like";
        -- 7: say "snake-like";
        -- 8: say "lizard-shaped";
        -- 9: say "bird-shaped";
        -- otherwise: say "regular";
 
To say homunculus-shape-gait:
    if the mem-state of the homunculus is:
        -- 0: say "strides";
        -- 1: say "skitters";
        -- 2: say "pads";
        -- 3: say "trots";
        -- 4: say "canters";
        -- 5: say "crawls";
        -- 6: say "swims";
        -- 7: say "slithers";
        -- 8: say "crawls";
        -- 9: say "flaps";
        -- otherwise: say "translates";
 
Rule for writing a paragraph about the homunculus:
    if the homunculus is not shifted:
        instead say "The black markings have disappeared from the broken mural. No, they've been replaced. Rewritten? You now see a dense cluster of silvery lines on the ceiling[if the homunculus is not motile], directly above the pedestal bound[end if]. They do not resemble the black graffiti you saw before; this is a random scribble of silver.";
    if the location is the Nave:
        instead say "The silvery scribble is visible on the ceiling, where you first saw it.";
    say "A scribble of silvery lines [follower-locale for location][homunculus-extra-locale for location para false]";
    say "."
 
Check examining the homunculus:
    if the location is the Nave:
        say "[one of]Is this the homunculus that the ritual promised? You[or]You suppose this silvery scribble is the homunculus that you summoned. You[stopping] have no idea what a homunculus is supposed to look like, outside of the doll-figures of medieval art";
        say ". [one of]You suppose this silvery scrawl[or]This scrawl[stopping]";
    else:
        say "The silver scribble has followed you; it now [follower-locale for location][homunculus-extra-locale for location para true]";
        say ". You suppose it";
    say " might be a distant cousin of the dragon-mandalas that you've [if dragon-first-seen is no-dragon]read about[else]seen[end if]. But it is entirely disorganized, chaotic";
    if the location is not the Nave:
        say ". Not to mention unnervingly mobile";
    bump the homunculus-shape;
    say ".[para]Although if you squint, you could imagine that the scribble has a [homunculus-shape-desc] outline";
    instead say "."
 
Check reading the homunculus:
    instead say "You cannot read the scribble. It doesn't appear to be writing at all."
 
Check taking the homunculus:
    if the location is follower-untouchable:
        instead say "The scribble is out of reach.";
    instead say "It's graffiti on the wall. You can't pick it up."
 
Check touching the homunculus:
    if the location is follower-untouchable:
        instead say "The scribble is out of reach.";
    instead say "You can feel no texture of ink or paint on the silver lines."
 
Check rubbing the homunculus:
    if the location is follower-untouchable:
        instead say "The scribble is out of reach.";
    instead say "The silver lines do not smear or fade, no matter how hard you rub them."
 
Check tapping the dispersal-brush on the homunculus:
    retire the dispersal-brush by manual destruction in the second noun;
    instead say "The moment the feather touches the silvery lines, it crackles and falls to dust. Whoops. The scribble is entirely unaffected."
 
Check putting the dispersal-brush on the homunculus:
    instead try tapping the dispersal-brush on the second noun.
 
Check putting something on the homunculus when the location is follower-untouchable:
    instead try touching the homunculus.
Check inserting something into the homunculus when the location is follower-untouchable:
    instead try touching the homunculus.
Check tapping something on the homunculus when the location is follower-untouchable:
    instead try touching the homunculus.
 
Check inspecting the homunculus with the planetary-lens:
    instead say "You peer at the silvery scribble through the planetary lens. Its associations are incomprehensible."
 
Check inspecting the homunculus with the oculus:
    instead say "You peer through the oculus at the silvery scribble. It has a more symmetrical, intricate cast from this vantage. You can make out the blend of fire, water, earth, and air that went into its making."
 
Carry out recalling the homunculus:
    if not chapter-1-done:
        say "You have no idea.";
    else if chapter-2-done:
        say "The scribble is gone.";
    else if the homunculus is in the location:
        say "The scribble is right here.";
    else if the homunculus is motile:
        say "You're not sure where the scribble is lurking.";
    else:
        if the Nave is not visited-this-cycle:
            say "You have not been there yet, but you presume the";
        else:
            say "The";
        say " scribble is in the Nave.";
    if ch2-homunculus-fact is known:
        say "[br][description of ch2-homunculus-fact][br]";
    stop the action.
 
Carry out visiting the homunculus:
    if not chapter-1-done:
        instead say "You have not made the homunculus yet.";
    else if chapter-2-done:
        instead say "The scribble is gone.";
    else if the homunculus is in the location:
        instead say "The scribble is right here.";
    else if the homunculus is motile:
        instead say "You're not sure where the scribble is lurking.";
    else:
        say "The scribble is in the Nave, as you recall.";
        instead try visiting the Nave.
 
Carry out creating the homunculus:
    if not chapter-1-done:
        instead say "You have no idea.";
    else if chapter-2-done:
        instead say "The Great Marriage worked before.";
    else if the homunculus is in the location:
        instead say "The scribble is right here.";
    else if the homunculus is motile:
        instead say "You're not sure where the scribble is lurking.";
    else:
        instead say "The scribble is in the Nave, as you recall."
 
 
Chapter - Endgame Code
 
Definition: a room is ballast-appropriate if it is the Bird-Crawl or it is the Garden-Pool or it is the Garden-Pool-Bottom or it is the Baros-Crawl or it is the Obs-Crawl.
 
[Do some wiggling to exclude debug-only actions from the limitation rule. (Meta actions are already excluded, because they have no "instead of" phase, but I need to cover a few more possibilities.)]
To continue-action-if-debug-action: (-
    #ifdef DEBUG;
    if (ActionIsDebug(action)) rfalse;
    #endif; ! DEBUG
-).
 
[I am suspicious of the complexities of this parser error, so we only customize it in the endgame.]
Rule for printing a parser error when post-game and the latest parser error is the nothing to do error:
    if current-tense is:
        -- present-tense: say "There are none at all available!";
        -- past-tense: say "There were none at all available!";
        -- perfect-tense: say "There have been none at all available!";
        -- future-tense: say "There will be none at all available!"
 
Instead of doing anything when post-game (this is the post-game limitation rule):
    if looking or waiting or taking inventory or exits-listing:
        continue the action;
    if going or exiting:
        continue the action;
    if the current action is recallish:
        continue the action;
    if invoking:
        continue the action;
    continue-action-if-debug-action;
    instead say no-time-for-that.
 
To say no-time-for-that:
    if current-tense is:
        -- present-tense: say "This is no time for that.";
        -- past-tense: say "That was no time for that.";
        -- perfect-tense: say "It is no time for that.";
        -- future-tense: say "This will be no time for that."
 
Check taking inventory when post-game:
    if the raw contents count of the player is zero:
        if current-tense is:
            -- present-tense: instead say "You are bereft.";
            -- past-tense: instead say "You were bereft.";
            -- perfect-tense: instead say "You are bereft.";
            -- future-tense: instead say "You will be bereft."
 
Check waiting when post-game:
    if current-tense is:
        -- present-tense: instead say "Time passes.";
        -- past-tense: instead say "Time passed.";
        -- perfect-tense: instead say "Time has passed.";
        -- future-tense: instead say "Time will pass."
 
To say not-sure-where-anything-is:
    if current-tense is:
        -- present-tense: say "You're not sure where anything is.";
        -- past-tense: say "You weren't sure where anything was.";
        -- perfect-tense: say "You're not sure where anything has been.";
        -- future-tense: say "You won't be sure where anything will be."
 
Check recalling-rooms when post-game:
    instead say not-sure-where-anything-is.
 
Check recalling-things when post-game:
    instead say not-sure-where-anything-is.
 
Check recalling-doors when post-game:
    instead say not-sure-where-anything-is.
 
Check recalling-formulae when post-game (this is the post-game-recalling-formulae rule):
    if current-tense is:
        -- present-tense: say "Your spinning mind can only catch hold of";
        -- past-tense: say "Your spinning mind was only able to catch";
        -- perfect-tense: say "Your spinning mind has only been able to catch";
        -- future-tense: say "Your spinning mind will only be able to catch";
    say " [the list of formulas *in known-formulas]";
    instead say "."
 
Check recalling-all when post-game:
    instead follow the post-game-recalling-formulae rule.
 
Check invoking the simple-seal-word when post-game:
    if the location is Endgame-3:
        if the ballast-level of Endgame-3 is not 2:
            say "You will have no assurance that this can possibly work. An apprentice bringing a marcher back to life... but still.";
        else:
            say "An apprentice bringing a marcher back to life... it should not be possible. But you will have a notion, a fragment of memory, that help will arrive. Repairs will be made.";
        instead complete the endgame;
    if current-tense is:
        -- present-tense: say "You manage to pronounce [the simple-seal-word]. Nothing happens";
        -- past-tense: say "You managed to pronounce [the simple-seal-word]. Nothing happened";
        -- perfect-tense: say "You have managed to pronounce [the simple-seal-word]. Nothing has happened";
        -- future-tense: say "You will manage to pronounce [the simple-seal-word]. Nothing will happen";
    instead say "."
 
The not-really-the-score rule is listed after the print player's obituary rule in the shutdown rules.
Shutdown rule (this is the not-really-the-score rule):
    say "[parsermsg]In the course of this game, you reset the world [reset-counter] times -- [forced-reset-counter] involuntarily[period][/parsermsg][br]";
 
 
Chapter - Goals
 
Include HL Game Goals by Andrew Plotkin.
 
 
Chapter - Env Influence
 
Section - Auto-Env Selection
 
[Attempts to get the player the tools for the desired ritual environment.
- Set the ritual-env of this goal before invoking.
- If goal-env-tool exists after this goal succeeds, it is an object that should be auto-dropped at the end of the ritual.
- Should always be the last goal invoked before generic-ritual-location. (Because this might drop you in a particular ritual location, and you want to keep that.)
- In some cases, such as phlegmatic-env, this can be used in place of generic-ritual-location. But I guess we're calling generic-ritual-location after it anyhow, just in case.
- Sadly, we can't name the ritual-env argument in the short-description, because this might be invoked recursively.]
The create-ritual-env-goal is an ever-done reentrant action-goal. The short-description is "set up an appropriate environment".
The create-ritual-env-goal has a ritual-env called the goal-env.
The create-ritual-env-goal has a thing called the goal-env-tool.
 
Goal prereqs rule for create-ritual-env-goal:
    [Clear the "arguments" immediately. Copy goal-env into a local.]
    now the goal-env-tool of create-ritual-env-goal is no-thing;
    let E be the goal-env of create-ritual-env-goal;
    now the goal-env of create-ritual-env-goal is no-env;
    let T be no-thing;
    if E is:
        -- no-env:
            say "(BUG) goal-env of create-ritual-env-goal was [E].";
            rule fails;
        -- bad-env:
            say "(BUG) goal-env of create-ritual-env-goal was [E].";
            rule fails;
        -- chymic-env: [shouldn't be called this way, really]
            rule succeeds;
        -- phlegmatic-env:
            require-or-fail Phleg-Lab;
            now the goal-env of create-ritual-env-goal is no-env;
            rule succeeds;
        -- fiery-env:
            [If we're locked in the starting area, always go with the ginger. (Without this case, the best-object is liable to be the fire-bench, and we can't get there yet.)]
            if the mech-door is dirty:
                let hadflag be whether or not the player carries the ginger-impet;
                require-or-fail ginger-impet;
                now the goal-env of create-ritual-env-goal is no-env;
                if hadflag is false:
                    now the goal-env-tool of create-ritual-env-goal is the ginger-impet;
                rule succeeds;
            [...otherwise fall out to the normal procedure.]
        -- fierier-env:
            [The fire-sucker ritual requires gold-ignition, so we know the player has visited the Fire-Store. But it's not necessarily true that they've used the fire-bench. If they have, we take the easy way out and choose it.]
            if fire-bench is ever-used:
                require-or-fail Fire-Store;
                now the goal-env of create-ritual-env-goal is no-env;
                rule succeeds;
            now E is fiery-env; [this is safe, honest!]
            [...otherwise fall out to the normal procedure, but for fiery-env rather than fierier-env. This is good enough.]
        -- catalytic-env:
            [I suspect the auto-env mechanism could get this right, but I want to do it manually]
            if 3rd-bench is ever-used:
                require-or-fail 3rd-Lab;
                now the goal-env of create-ritual-env-goal is no-env;
                rule succeeds;
            let LG be the location of the groove-bench;
            if the platinum-wire is in the wire-groove:
                require-or-fail LG;
                now the goal-env-tool of create-ritual-env-goal is no-thing;
                say "[The platinum-wire] is already in the bound groove.";
                rule succeeds;
            require-or-fail the platinum-wire;
            require-or-fail LG;
            now the goal-env-tool of create-ritual-env-goal is no-thing;
            now all metal-wires in the wire-groove are in LG;
            now the platinum-wire is in the wire-groove;
            say "You lay [the platinum-wire] in the bound groove.";
            rule succeeds;
        -- quicksilver-env:
            if best-amalgam-wire is no-thing:
                say "You don't know how to achieve a quicksilver environment.";
                rule fails;
            let LG be the location of the groove-bench;
            if the best-amalgam-wire is in the wire-groove:
                require-or-fail LG;
                now the goal-env-tool of create-ritual-env-goal is no-thing;
                say "[The best-amalgam-wire] is already in the bound groove.";
                rule succeeds;
            require-or-fail the best-amalgam-wire;
            require-or-fail LG;
            now the goal-env-tool of create-ritual-env-goal is no-thing;
            now all metal-wires in the wire-groove are in LG;
            now the best-amalgam-wire is in the wire-groove;
            say "You lay [the best-amalgam-wire] in the bound groove.";
            rule succeeds;
    let T be the best object for E;
    if T is nothing or T is no-thing:
        [Should we block the player just because we can't remember what env-influence was used? Nah.]
        unless release mode:
            say "(DEBUG) No known env-tool for [E]; permitting anyway.";
        rule succeeds;
    if T is the groove-bench:
        let TW be the influence metal-wire for E;
        if TW is nothing or TW is no-thing:
            say "(BUG) [The groove-bench] cannot achieve [E].";
            rule fails;
        let LG be the location of the groove-bench;
        if TW is in the wire-groove:
            require-or-fail LG;
            now the goal-env-tool of create-ritual-env-goal is no-thing;
            say "[The TW] is already in the bound groove.";
            rule succeeds;
        require-or-fail TW;
        require-or-fail LG;
        now the goal-env-tool of create-ritual-env-goal is no-thing;
        now all metal-wires in the wire-groove are in LG;
        now TW is in the wire-groove;
        say "You lay [the TW] in the bound groove.";
        rule succeeds;
    if T is a ritual-bound:
        require-or-fail the location of T;
        now the goal-env-tool of create-ritual-env-goal is no-thing;
        rule succeeds;
    let hadflag be whether or not the player carries T;
    require-or-fail T;
    [### phlo-gold, phlo-electrum is another special case -- they change nature when lit]
    if T is the infotater: [special case]
        set the infotater for E;
    if hadflag is false:
        now the goal-env-tool of create-ritual-env-goal is T;
    rule succeeds.
 
Section - Env Influence Rules
 
Env influence rule for the fire-bench:
    influence fiery-env.
 
Env influence rule for the 3rd-bench:
    influence catalytic-env by 100. [the other catalytic influence]
 
Env influence rule for the deep-bench:
    influence phlegmatic-env by 100. [the only phlegmatic influence]
 
Env influence rule for the groove-bench:
    let T be the first thing held by the wire-groove;
    if T is platinum-wire and the aroma of the location of groove-bench is no-odor:
        influence catalytic-env by 100;  [the only catalytic influence outside the 3rd-bench]
    if T is white-amalgam-wire or T is gold-amalgam-wire:
        now the best-amalgam-wire is T;
        influence quicksilver-env by 100;  [the only quicksilver influence]
    if T is lead-wire:
        influence anchor-env by 2;
    if T is gold-wire:
        influence helian-env;
    if T is moon-metal-wire:
        influence lunar-env;
 
To decide what metal-wire is the influence metal-wire for (E - ritual-env):
    if E is:
        [Don't handle platinum, amalgam cases here.]
        -- anchor-env: decide on lead-wire;
        -- helian-env: decide on gold-wire;
        -- lunar-env: decide on moon-metal-wire;
        -- otherwise: really decide on nothing.
 
Env influence rule for the moon-metal-rod:
    influence lunar-env.
 
Env influence rule for the moon-metal-wire:
    influence lunar-env.
 
Env influence rule for the phlo-gold:
    if the phlo-gold is alight:
        influence fiery-env by 2;
    else:
        influence helian-env.
 
Env influence rule for the phlo-electrum:
    if the phlo-electrum is alight:
        influence fiery-env by 2.
 
Env influence rule for the gold-rod:
    influence helian-env.
 
Env influence rule for the gold-wire:
    influence helian-env.
 
Env influence rule for the lead-rod:
    influence anchor-env.
 
Env influence rule for the lead-wire:
    influence anchor-env.
 
Env influence rule for the mercury:
    do nothing.
 
Env influence rule for the F-sharp-chime:
    influence earthy-env.
 
Env influence rule for the G-flat-chime:
    influence helian-env.
 
Env influence rule for the B-chime:
    influence exhilarant-env.
 
Env influence rule for the H-chime:
    influence exhilarant-env.
 
Env influence rule for a bubble:
    influence exhilarant-env.
 
Env influence rule for the paten:
    influence exhilarant-env.
 
Env influence rule for a wood-splint (called T):
    if T is alight:
        influence fiery-env by 2;
    else:
        influence fiery-env by 1.
 
Env influence rule for a metal-seal (called T):
    if the smetal of T is:
        -- lead-smetal: influence anchor-env by 1;
        -- gold-amalgam-smetal: do nothing;
        -- red-amalgam-smetal: do nothing;
        -- white-amalgam-smetal: do nothing;
        -- rutilum-smetal: influence spiritual-env by 1.
 
Env influence rule for a pebble:
    influence earthy-env.
 
Env influence rule for the rock-salt:
    influence earthy-env.
 
Env influence rule for a quartz-prism:
    influence orderly-env.
 
Env influence rule for the fluorite:
    influence orderly-env.
 
Env influence rule for the rosemary:
    influence anchor-env.
 
Env influence rule for the honeysuckle:
    influence helian-env.
 
Env influence rule for the mustard:
    influence fiery-env.
 
Env influence rule for the mushroom:
    influence earthy-env.
 
Env influence rule for the fire-resistance:
    influence fiery-env.
 
Env influence rule for the fire-sucker:
    influence fiery-env.
 
Env influence rule for the silver-chain:
    influence lunar-env.
 
Env influence rule for the purity-lodestone:
    influence lunar-env.
 
Env influence rule for the silver-coin:
    influence lunar-env.
 
Env influence rule for the brass-coin:
    influence helian-env.
 
Env influence rule for the horn-coin:
    influence anchor-env.
 
Env influence rule for the calipers:
    influence orderly-env.
 
Env influence rule for the 3rd-key:
    influence orderly-env.
 
Env influence rule for the hall-key:
    influence orderly-env.
 
Env influence rule for the baros-key:
    influence orderly-env.
 
Env influence rule for a tin-slip thing:
    influence orderly-env.
 
Env influence rule for the measuring-block:
    influence orderly-env.
 
Env influence rule for the ivory-bead:
    influence spiritual-env.
 
Env influence rule for the tao-amulet:
    influence spiritual-env by 3.
 
Env influence rule for the polar-oil:
    influence no-env by 3.
 
Env influence rule for the infotater:
    if the weather-symbol of the infotater is:
        -- snowy-day: influence arctic-env;
        -- windy-day: influence exhilarant-env;
        -- sunny-day: influence helian-env;
        -- moonlit-night: influence lunar-env;
        -- rainbow-day: influence spiritual-env.
 
To set the infotater for (E - ritual-env):
    if E is:
        -- arctic-env: now the weather-symbol of the infotater is snowy-day;
        -- exhilarant-env: now the weather-symbol of the infotater is windy-day;
        -- helian-env: now the weather-symbol of the infotater is sunny-day;
        -- lunar-env: now the weather-symbol of the infotater is moonlit-night;
        -- spiritual-env: now the weather-symbol of the infotater is rainbow-day;
        -- otherwise: say "(BUG) [The infotater] cannot be set for [E]."
 
 
Chapter - Debugging
 
Include HL Debug by Andrew Plotkin.
 
Section  - Debug Verbs - not for release
 
Test down with "x table / read sheet / put bolt in arc / open ginger / say sealing / say nature / wave rosemary / say lesser / get bolt / put bolt on hatch / open hatch / down".
Test fulcrum with "zap-omni / zap-chapter / zap-wake baros / purloin white amalgam wire / perform fulcrum / abstract granite to barosy / go to nave / purloin measuring block / put block on shelf / say marcher / say symmetric / say dracon".
 
Chapter-zapping is an action out of world applying to nothing.
Endgame-zapping is an action out of world applying to nothing.
Zap-waking is an action out of world applying to two visible things.
 
Understand "zap-dragon [any dragon]" as zapping.
Understand "zap-chapter" as chapter-zapping.
Understand "zap-endgame" as endgame-zapping.
Understand "zap-wake [any dragon]" as zap-waking.
Understand "zap-wake [any dragon] from/by/with [any dragon]" as zap-waking.
Understand "zap-wake [any dragon] to [any dragon]" as zap-waking (with nouns reversed).
 
Understand "story-test" as a mistake ("[debug-story-state]").
To say debug-story-state:
    repeat with D running through dragons:
        if D is not no-dragon:
            say "[D] ([persona of D]) is [if D is fixed]fixed/[end if][dragon condition of D].";
    repeat with P running through personas:
        let MC be the mem-character associated with P;
        if MC is not nothing:
            if the story-resolution of MC is no-persona:
                say "- [MC] is unresolved";
            else:
                say "- [MC] resolves to [story-resolution of MC]";
            if there is an on-stage non-shadowy character (called P2) that persona-matches P:
                let R be the location of P2;
                say " (currently [refer-preposition of R] [refer-name of R])";
            if there is an on-stage shadowy character (called P2) that persona-matches P:
                let R be the location of P2;
                say " (shadow [refer-preposition of R] [refer-name of R])";
            say ".";
    sanity-check dragons;
 
Understand "lamp-test" as a mistake ("[debug-display-lamps]").
To say debug-display-lamps:
    say "No lamps: ... ";
    repeat with R running through all not lamp-enabled rooms:
        say ", [the R]";
    say ".";
    say "Has lamps: ... ";
    repeat with R running through all lamp-enabled rooms:
        say ", [the R]";
    say "."
 
Understand "pullside-test" as a mistake ("[debug-door-pullside]").
To say debug-door-pullside:
    say "Doors without pullside:.";
    repeat with T running through doors:
        if the pull-side of T is-room off-stagey:
            say "... [T].";
 
Understand "query-test" as a mistake ("[debug-query-test]").
To say debug-query-test:
    say "Are you a turtle?[line break]>>";
    if the player consents-or-restores:
        say "Yes you are.";
    else:
        say "No, you are a tortoise.".
 
Understand "visit-test" as a mistake ("[debug-rooms-visited]").
To say debug-rooms-visited:
    say "Rooms visited: ... ";
    repeat with R running through all visited rooms:
        say ", [the R]";
    say ".";
    say "Rooms visited this cycle: ... ";
    repeat with R running through all visited-this-cycle rooms:
        say ", [the R]";
    say ".".
 
To decide what number is debug-rule-frames: (- rule_frames -).
To decide what number is debug-rulechange-sp: (- rulechange_sp -).
Understand "rule_frames" as a mistake ("rule_frames = [debug-rule-frames], rulechange_sp = [debug-rulechange-sp].").
 
[
Understand "roomcount-test" as a mistake ("[debug-display-roomcount]").
To say debug-display-roomcount:
    say "[Number of follower-enabled rooms] rooms are follower-enabled: ... ";
    repeat with R running through all follower-enabled rooms:
        say ", [the R]";
    say ".[para]";
    say "[Number of follower-disabled rooms] rooms are follower-disabled: ... ";
    repeat with R running through all follower-disabled rooms:
        say ", [the R]";
    say ".".
]
 
Understand "recipecount-test" as a mistake ("[debug-display-recipecount]").
To say debug-display-recipecount:
    say "Currently [number of recallable debug-described action-goals] of [number of recallable action-goals] recallable rituals are described.";
    say "Remaining: ... ";
    repeat with T running through all recallable debug-undescribed action-goals:
        say ", [the T]";
    say ".".
Definition: an action-goal is debug-described rather than debug-undescribed if the description of it is not "(BUG) Undescribed action-goal."
 
Carry out chapter-zapping:
    complete initial marriage;
    say "(BUG) You pretend to have performed the initial Great Marriage."
 
Carry out endgame-zapping:
    now the Lab-Hall-SW is visited;
    if not chapter-1-done:
        complete initial marriage;
    if not chapter-2-done:
        initially wake Baros;
    complete the game proper with ballast 0;
    say "(BUG) You pretend to have completed the game proper."
 
To omni-zap everything else:
    if the tool-used of g-gold-cabinet is no-thing:
        now the tool-used of g-gold-cabinet is the rutilum-seal;
    if the symbol-type of g-in-med-wing is no-symbol:
        now the symbol-type of g-in-med-wing is invisibility-symbol;
    if the symbol-type of g-bird-door is no-symbol:
        now the symbol-type of g-bird-door is invisibility-symbol;
    if the tool-used of g-charred-hall is no-thing:
        now the tool-used of g-charred-hall is fire-sucker;
    if the symbol-type of g-bridge-ladder is no-symbol:
        now the symbol-type of g-bridge-ladder is ponderosity-symbol;
    if the key-used of g-baros-door is no-thing:
        now the key-used of g-baros-door is clock-tincture;
    if the tool-used of g-tilt-slab is no-thing:
        now the tool-used of g-tilt-slab is the B-chime;
    now the fire-bench is ever-used;
    set the best object for fiery-env to the ginger-impet;
    set the best object for catalytic-env to the groove-bench;
    set the best object for lunar-env to the silver-coin;
    set the best object for exhilarant-env to the kelp-impet;
    set the best object for earthy-env to the rock-salt;
    set the best object for anchor-env to the horn-coin;
    set the best object for helian-env to the brass-coin;
    set the best object for orderly-env to the measuring-block;
    set the best object for spiritual-env to the tao-amulet;
    now the best-amalgam-wire is white-amalgam-wire;
 
Omni-start-zapping is an action out of world applying to nothing.
Understand "zap-omni start" as omni-start-zapping.
 
Carry out omni-start-zapping:
    now the steel-bolt is ever-seen;
    now the fake-lab-door is discovered;
    mark Lesser Saturation as known;
    set the best object for fiery-env to the ginger-impet;
    mark unrust-brass-inscription as done;
    mark unrust-steel-inscription as done;
    mark g-2nd-hatch as done;
    mark super-unrust-brass-inscription as done;
    mark super-unrust-steel-inscription as done;
    set the best object for catalytic-env to the groove-bench;
    mark gen-unrust-brass-inscription as done;
    mark gen-unrust-steel-inscription as done;
    mark g-mech-hatch as done;
    mark g-chem-hatch as done;
    now the 2nd-Crawl is visited;
    now the Mech-Crawl is visited;
    now the Herb-Crawl is visited;
    now the Chem-Crawl is visited;
    now the Herbarium is visited;
    now the Chem-Lab is visited;
    now the Mech-Lab is visited;
    now the Void-Room is visited;
    mark hermetic-seal-word as known;
    mark binding-antipathy as known;
    mark chymic-ritual-location as done;
    mark fungicide-creation as done;
    now the fungicide is ever-seen;
    mark g-mech-door as done;
    now the alcohol is ever-seen;
    now every takeable-thing in the Herbarium is ever-seen;
    now every takeable-thing on the herb-shelf is ever-seen;
    now every takeable-thing in the Chem-Lab is ever-seen;
    now every takeable-thing on the chem-rack is ever-seen;
    now the hall-key is ever-seen;
    now the Fire-Lab is visited;
    now the Opt-Lab is visited;
    now the Opt-Store is visited;
    now the feather is ever-seen;
    mark g-opt-door as done;
    now the Safe-Store is visited;
    mark g-store-door as done;
    mark fire-resistance-creation as done;
    now the fire-resistance is ever-seen;
    mark kiln-reach-goal as done;
    mark g-hall-door as done;
    repeat with R running through rooms: [can't do this with a description, due to bug 1046]
        let G be the zone of R;
        if G is lab-hall-zone or G is core-hall-zone or G is basement-zone or G is garden-zone:
            now R is visited;
    begin tutorial phase 99;
    say "You figure out the start of the game."
 
Omni-alien-zapping is an action out of world applying to nothing.
Understand "zap-omni alien" as omni-alien-zapping.
 
Carry out omni-alien-zapping:
    mark radix-pattern as known;
    mark caudex-pattern as known;
    mark calyx-pattern as known;
    say "You learn the three alien patterns."
 
Carry out zapping a locked door:
    now the noun is unlocked;
    say "(DEBUG) [The noun] is now unlocked."
 
Carry out zapping the 2nd-hatch:
    now the 2nd-hatch is clean;
    say "(DEBUG) [The noun] is now clean."
 
Carry out zapping the mech-hatch:
    now the mech-hatch is clean;
    say "(DEBUG) [The noun] is now clean."
 
Carry out zapping the store-safe:
    now the noun is unlocked;
    say "(DEBUG) [The noun] is now unlocked."
 
Carry out zapping the scalpel:
    if the scalpel is dirty:
        now the scalpel is clean;
        instead say "(DEBUG) Cleansed the scalpel.";
    else:
        inscribe the noun with prophylaxis-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping the counterweight:
    if the symbol-type of the counterweight is no-symbol:
        now the symbol-type of the counterweight is gossamerity-symbol;
    else if the symbol-type of the counterweight is gossamerity-symbol:
        now the symbol-type of the counterweight is ponderosity-symbol;
    else if the symbol-type of the counterweight is ponderosity-symbol:
        now the symbol-type of the counterweight is no-symbol;
    else:
        instead say "(BUG) Why is the counterweight [symbol-type of the counterweight]?";
    instead say "(DEBUG) Now the counterweight is [symbol-type of the counterweight]."
 
To special-case zap-see (G - object):
    if G is aura-imitation-persona-charge:
        if the persona of aura-imitation-persona-charge is no-persona:
            now the persona of aura-imitation-persona-charge is Captain;
        else if the persona of aura-imitation-persona-charge is Captain:
            now the persona of aura-imitation-persona-charge is Grafter;
        else if the persona of aura-imitation-persona-charge is Grafter:
            now the persona of aura-imitation-persona-charge is Climber;
        else:
            now the persona of aura-imitation-persona-charge is no-persona;
        say "(Now a-im-pc persona is [the persona of aura-imitation-persona-charge].)";
    if G is g-dome-hatch:
        if Pneuma is fixed:
            now g-dome-hatch is bypassed;
            say "(Now g-dome-hatch is bypassed.)";
    if G is g-bird-door:
        if the symbol-type of g-bird-door is invisibility-symbol:
            now the symbol-type of g-bird-door is imitation-symbol;
        else:
            now the symbol-type of g-bird-door is invisibility-symbol;
        say "(Now g-bird-door is [symbol-type of g-bird-door].)";
    if G is g-charred-hall:
        if the tool-used of g-charred-hall is fire-sucker:
            now the tool-used of g-charred-hall is fire-resistance;
        else:
            now the tool-used of g-charred-hall is fire-sucker;
        say "(Now g-charred-hall is [tool-used of g-charred-hall].)";
    if G is g-alien-window:
        if the symbol-type of g-alien-window is permeability-symbol:
            now the symbol-type of g-alien-window is decoherence-symbol;
        else:
            now the symbol-type of g-alien-window is permeability-symbol;
        say "(Now g-alien-window is [symbol-type of g-alien-window].)";
 
Carry out zapping a memspark:
    now the noun is prominent-scenery;
    instead say "(DEBUG) The [noun] is now prominent-scenery."
 
Carry out zapping a bubble:
    if the noun is uncharged:
        now the noun is charged;
        instead say "(DEBUG) Charged [the noun].";
    else:
        now the noun is uncharged;
        instead say "(DEBUG) Uncharged [the noun]."
 
Carry out zapping a dragon:
    [low-level state alteration]
    if the noun is asleep:
        now the noun is active;
    else if the noun is active:
        now the noun is dead;
    else:
        now the noun is asleep;
    instead say "(DEBUG) The [noun] is now [dragon condition of noun]."
 
Carry out zap-waking:
    [high-level state alteration]
    if noun is nothing:
        instead say "(DEBUG BUG) Cannot wake nothing.";
    if second noun is nothing:
        say "(DEBUG) Performing initial wake of [noun].";
        initially wake the noun;
    else:
        say "(DEBUG) Performing wake of [noun] from [second noun].";
        wake the noun from the second noun;
    follow the reset dragon positions rule;
    sanity-check dragons.
 
Section - Dump Text for iOS UI - not for release
 
To decide what number is the numeric address of (O - object): (- {O} -).
To say first name word of (O - object): (- DebugPrintFirstNameWord({O}); -).
Include (-
[ DebugPrintFirstNameWord obj addr;
    addr = obj.&name;
    if (addr)
        print (address) (addr-->0);
];
-).
 
Understand "dump-rooms" as a mistake ("[debug-dump-rooms]").
To say debug-dump-rooms:
    say "*** ROOMS:[para]";
    repeat with R running through rooms:
        if R is the Abstraction Layer or R is endgame-1 or R is endgame-2 or R is endgame-3:
            continue the loop;
        say "** [numeric address of R] [first name word of R] <[R]>[br]";
        say "**.[para]";
 
Understand "dump-formulas" as a mistake ("[debug-dump-formulas]").
To say debug-dump-formulas:
    say "*** FORMULAS:[para]";
    repeat with F running through formulas:
        if F is no-word or F is xyzzy:
            continue the loop;
        say "** [numeric address of F] [first name word of F] <[F]>[br]";
        say description of F;
        say "[br]**.[para]";
 
Understand "dump-rituals" as a mistake ("[debug-dump-rituals]").
To say debug-dump-rituals:
    say "*** RITUALS:[para]";
    repeat with G running through recallable action-goals:
        if G is a test-action-goal:
            continue the loop;
        say "** [numeric address of G] [first name word of G] <[G]>[br]";
        say description of G;
        say "[br]**.[para]";
 
Understand "dump-facts" as a mistake ("[debug-dump-facts]").
To say debug-dump-facts:
    say "*** FACTS:[para]";
    repeat with F running through tidbits:
        say "** [numeric address of F] [first name word of F] <[F]>[br]";
        say description of F;
        say "[br]**.[para]";
 
 
[End of file.]