! This file is part of the game: Typo!
! Copyright 2004 Kevin Lynn and Peter Seebach.  Feel free to 
! copy what you need as long as you give credit where it's
! due.  No fair stealing.  Dibs.

! ------- field service manual:
Attribute legible;
Object  manual "Field Service Manual" 
  has   legible transparent openable ~open,
  with  name 'docs' 'field' 'service' 'manual' 'subtitle' 
             'instructions' 'book' 'cover' 'title',
        article "the",
        description 
            "The title reads simply ~Field Service Manual~. There's
            also a subtitle which indicates that the book contains
            information describing correct procedures for operating
            and servicing the machine. This is a book of truly
            biblical proportions, with thousands of dog-eared 
            pages. Fortunately, it has a large and comprehensive 
            index, which will make it easy to look up various topics.",
        before [ w1 w2 subject j c i;
          Consult, Read:
            consultations = consultations + 1;
            wn = consult_from;
            w1 = NextWord();            ! First word of subject
            w2 = NextWord();            ! Second word (if any) of subject
            if (consult_words == 1)
                subject = w1;
            else if (consult_words <= 3)
                subject = w2;
            else
                "Try ~look up <topic> in manual~.";
            if (noun in actor) {
                switch (noun) {
                  manual:
                    switch (subject) {
                      0: print "The term ~";
                          for (j = 0: j < consult_words: ++j) {
                              c = WordAddress(consult_from + j);
                              for (i = 0: i < WordLength(consult_from + j): ++i) {
                                  print (char) c->i;
                              }
                              if (j + 1 < consult_words)
                                  print " ";
                          };
                          print_ret "~ doesn't appear in the manual's index or glossary.";

                      '1//', 'one': 
                         if (w1 == 'compartment') 
                           "~Compartment 1 holds standard finishing options.~";
                         else {
                           "There is no matching entry, though there is mention of
                           a ~compartment 1~.";
                         }

                      '2//', 'two': 
                         if (w1 == 'compartment') 
                           "~Compartment 2 holds premium finishing options!~";
                         else {
                           "There is no matching entry, though there is mention of
                           a ~compartment 2~.";
                         }

                      'access':
                         print "~See the entry for ";
                         em("compartment"); 
                         print_ret ".~ ";

                      'applicator': "~The border-free applicator is patented. To prevent
                         inadvertent patent violations, the applicator cannot be removed,
                         inspected, serviced, or cleaned. Deliberate patent violations 
                         are prevented by the built-in lethal response system.~";

                      'barrel':
                         if (w1 == 'copper') "~The contents of the copper-colored barrel
                           are applied to the product using the waterfall process during manufacturing.
                           Contents are transfered under pressure to the fabrication 
                           subsystem via the red conduit. The conduit and coupling should
                           be cleaned and inspected before being attached.~";
                         else if (w1 == 'silver') "~The contents of the silver-colored barrel
                           are applied to the product using the patented border-free applicator during 
                           manufacturing.
                           Contents are transfered under pressure to the fabrication 
                           subsystem via the white conduit. The conduit and coupling should
                           be cleaned and inspected before being attached.~";
                         else if (w1 == 'pickle') "~Pickles. In a barrel. There's nothing
                           bitter. Better.~";
                         else "There are 3 matching entries: ~copper barrel~,
                              ~silver barrel~, and ~pickle barrel~.";

                      'beeps', 'clinking', 'clanking', 'hissing': 
                         print "~When engaged, the automated order receiving system will
                         periodically emit a series of onomatopoetic beeps.
                         See also the entry for ";
                         em("noises");
                         print_ret ".~ ";

                      'bin': 
                         print "~See the entry for ";
                         em("hopper");
                         print_ret ".~ ";

                      'bits': 
                         print "~See the entry for ";
                         em("gunk");
                         print_ret ".~ ";

                      'blinking': 
                         print "~See the entry for ";
                         em("flashing");
                         print_ret ".~ ";

                      'cable': 
                         print "~See the entry for ";
                         em("wire");
                         print_ret ".~ ";

                      'cardboard', 'bundle': 
                         "~Raw materials for the packaging subsystem include 
                         the labeling tray and the bundles of cardboard from which
                         the packaging is made.~";

                      'cartridge', 'cart':
                         if (w1 == 'standard' or 'premium') 
                           "~Finishing options are priced according to their
                           category: standard or premium. To facilitate more
                           accurate cost accounting, optional finishing 
                           supplies are maintained in separate supply
                           cartridges.~";
                         else "There are 2 matching entries: 
                           ~standard cartridge~ and ~premium cartridge~.";

                      'chimney', 'exhaust', 'pipe': 
                         "~The exhaust system is configured during the installation
                         process and cannot be repaired or modified in the field.
                         ~";

                      'compartment':
                         "There are 2 matching entries: 
                          ~compartment 1~ and ~compartment 2~.";

                      'conduit': 
                         print "~See the entry for ";
                         em("hose"); 
                         print_ret ".~ ";

                      'conveyor', 'belt': 
                         "~The conveyor belt will automatically engage when the 
                         production cycle is complete, making the finished
                         product available for shipping.~";

                      'copper': 
                         print "There's no entry for ~copper~, but there are several
                         passing references to a ";
                         em("copper barrel"); 
                         print_ret ".~ ";

                      'door': 
                         print "~See the entry for ";
                         em("compartment"); 
                         print_ret ".~ ";

                      'flashing': 
                         print "~See the entry for ";
                         em("indicator light"); 
                         print_ret ".~ ";

                      'flotsam': 
                         print "~See the entry for ";
                         em("jetsam"); 
                         print_ret ".~ ";

                      'fluid': 
                         print "~During operation, visual inspection of the coiled
                           tube indicates that component materials are being properly
                           combined. Black fluid flowing through the tube is an
                           indication that the machine is misconfigured. Verify that 
                           the order processing and manufacturing subsystems are 
                           operating properly. See also the entry for ";
                         em("tube");
                         print_ret ".~ ";

                      'flush', 'flushing': 
                         print "~When engaged, the manufacturing subsystem can periodically
                         emit a flushing sound, as components are moved through the
                         system.  See also the entry for ";
                         em("noises");
                         print_ret ".~ ";

                      'gunk': 
                         print "~See the entry for ";
                         em("stuff");
                         print_ret ".~ ";

                      'hatch': 
                         "~The hatch remains closed during the manufacturing process,
                         but will automatically open when production is complete.~";

                      'hopper': 
                         "~The bin or hopper holds the raw material from which
                         the final packaging is produced.~";

                      'hose': 
                         if (w1 == 'red') "~The red supply hose conveys raw materials
                           from the copper barrel directly into the manufacturing 
                           subsystem.~";
                         else if (w1 == 'white') "~The white supply hose conveys raw 
                           materials from the silver barrel directly into the 
                           manufacturing subsystem.~";
                         else if (w1 == 'blue') "~It is imperative for the safety of the
                           operator that the blue hose be connected correctly before
                           the machine is activated.~";
                         else "There are 3 matching entries: 
                              ~red hose~, ~white hose~, and ~blue hose~.";

                      'hum', 'humming': 
                         print "~When engaged, the primary power system will emit a humming
                         sound. This sound is within normal operating parameters.
                         See also the entry for ";
                         em("noises");
                         print_ret ".~ ";

                      'introduction', 'docs': 
                         <<read intro>>;

                      'jack': 
                         if (w1 == 'hydraulic') 
                           "~This car comes with a high-powered hydraulic jack, suitable
                           for lifting any one corner of the car. Please do not use the
                           jack to crush your little sister's head like an egg.~";
                         else if (w1 == 'wall') 
                           "Unattended operation requires that the order processing unit
                           be connected to a POTS system jack.~";
                         else "There are 2 matching entries:
                              ~hydraulic jack~ and ~wall jack~.";

                      'jetsam': 
                         print "~See the entry for ";
                         em("lagan"); 
                         print_ret ".~ ";

                      'lagan': 
                         print "~See the entry for ";
                         em("stuff"); 
                         print_ret ".~ ";

                      !'lethal', 'response': 
                      !   print "~See the entry for ";
                      !   em("lethal response system"); 
                      !   print_ret ".~ ";

                      'light', 'indicator': 
                         if (w1 == 'blue') "~The blue indicator light reflects the current
                           status of the order processing subsystem.~";
                         else if (w1 == 'yellow') "~The yellow indicator light reflects
                           the status of the fabrication subsystem.~";
                         else if (w1 == 'green')  "~The green indicator light reflects
                           the status of the packaging and labeling subsystem.~";
                         else if (w1 == 'flashing') "~Flashing lights indicate that a 
                           problem exists within the indicated system.~";
                         else "There are 4 matching entries: 
                              ~blue light~, ~yellow light~, ~green light~, and
                              ~flashing light~.";

                      'machine': 
                         print "Well, there's no entry for ~machine~, so you turn to the 
                               introduction. ";
                         <read intro>;
                         rtrue;

                      'noise', 'noises', 'onomatopoeia', 'onomatopoetic', 'feedback':
                         "~The patented onomatopoetic feedback system permits quick and 
                         accurate diagnosis of the state of the machine via the sounds
                         it emits. Every sound emitted by the system is guaranteed to
                         be an onomatope! Simply consult this manual about the sounds 
                         produced by the machine.~";

                      'output': 
                         print "~See the entry for ";
                         em("produce"); 
                         print_ret ".~ ";
 
                      'panel':
                        "~All machine functions are controlled via the switches on the
                        control panel.~";

                      'phone': 
                         print "~See the entry for ";
                         em("wire"); 
                         print_ret ".~ ";

                      ! 'pizza': "pizza hose hose~.";

                      'platform': 
                         "~The raised platform at the rear of the machine houses
                         the barrels and the hoppper.~";

                      'pots': "~Plain Old Telephone Service.~";

                      'premium': 
                         print "There's no entry for ~premium~, but there is a
                         reference to a ";
                         em("premium cartridge"); 
                         print_ret ".~ ";

                      'process': "~The waterfall process is the method by which liquid
                         components are applied to the product during the fabrication 
                         process.~";

                      'product', 'purpose': 
                         if (w1 == 'end') {
                           print "~See the entry for ";
                           em("finished product"); 
                           print_ret ".~ ";
                         }
                         else if (w1 == 'finished') {
                           print "~See the entry for ";
                           em("output"); 
                           print_ret ".~ ";
                         }
                         else {
                           print "~See the entry for ";
                           em("end product"); 
                           print_ret ".~ ";
                        }

                      !'red' 'white' 'blue':
                      !  <<consult manual "hose">>;

                      'silver': 
                         print "There's no entry for ~silver~, but there are several
                         passing references to a ";
                         em("silver barrel"); 
                         print_ret ".~ ";

                      'slot': 
                         print "~See the entry for ";
                         em("paper tray"); 
                         print_ret ".~ ";

                      'standard': 
                         print "There's no entry for ~standard~, but there is a
                         reference to a ";
                         em("standard cartridge"); 
                         print_ret ".~ ";

                      'stuff':
                         if (w1 == 'red' or 'crusty') 
                           "~One of the enhancements available with this new model of 
                           the machine is that it no longer produces the crusty red stuff.~";
                         else if (w1 == 'white' or 'gooey')
                           "~One of the enhancements available with this new model of 
                           the machine is that it no longer produces the gooey white stuff.~";
                         else "~Production of stuff, gunk, and other byproducts of the manufacturing
                              process is greatly reduced in the current version of the
                              apparatus.~";
   
                      'spigot':
                         "~Each barrel has an automatically controlled spigot to which
                         a supply conduit is attached.~";

                      'subsystem', 'system', 'unit', 'processing', 'order', 'fulfillment', 
                      'fabrication', 'manufacturing', 'finishing', 'packaging', 'labeling',
                      'shipping', 'lethal', 'response': 
                         if (w1 == 'order' or 'processing' or 'fulfillment') 
                           "~The order processing subsystem, also referred to as the fulfillment
                           subsystem, receives incoming orders and initiates production. Control
                           is passed from the order processing subsystem to the fabrication
                           system.~";
                         else if (w1 == 'fabrication' or 'manufacturing')
                           "~Fabrication subsystem activities are scheduled by the order 
                            processing subsystem. When activated, this unit executes 
                            predefined processes, effecting construction of the finished
                            product.
                             ~";
                         else if (w1 == 'finishing' or 'packaging' or 'labeling' or 'shipping')
                           "~The finishing subsystem prepares the product for final transport 
                           to the customer.~";
                         else if (w1 == 'response' or 'lethal' or 'security')
                           "~The lethal response system for patent protection is one
                           of the built-in safety features of the machine. Owners, operators,
                           and service technicians are protected from any legal action that
                           could result from patent infringement.~";
                         else "There are 4 matching entries: ~order processing subsystem~, 
                              ~fabrication subsystem~,
                              ~packaging subsystem~, and
                              ~lethal response system~.";

                      'superfluum': "~1. There is no such word as superfluum, and yet
                         its meaning is obvious.  2. This definition is a perfect
                         example.~";

                      'switch', 'button': 
                         if (w1 == 'power') "~The power switch is used to control the
                           application of electrical power to all systems. Failure to
                           properly apply electrical power may result in damage to the
                           machine or the operator.~"; 
                         if (w1 == 'blue') "~The blue switch engages and disengages
                           the order processing subsystem.~";
                         else if (w1 == 'yellow') "~The yellow switch engages and disengages
                           the fabrication subsystem.~";
                         else if (w1 == 'green')  "~The green switch engages and disengages
                           the packaging and labeling subsystem.~";
                         else if (w1 == 'dip') "~There are 57 dip switches which together
                           determine the configuration of the machine. Improper dip switch
                           configuration can result in operator death or even damage to 
                           the machine.~";
                         else "There are 5 matching entries: ~power switch~, 
                              ~blue switch~, ~yellow switch~, ~green switch~, and
                              ~dip switch~.";

                      'tray', 'paper': 
                         "~Because of the potentially dangerous nature of the paper used
                         by the system, the paper tray cannot be opened
                         or refilled by the user. Trays should be returned to the vendor
                         for refilling.~";

                      'tube', 'transparent': 
                         "~During normal operation, visual inspection of the coiled
                         tube will indicate correct flow of component materials. The
                         operator should visually verify that the correct fluids are
                         flowing through the tube during the manufacturing process.~";

                      'typo': "~This manuel has been throughly tested and is certafied
                         free of typografikal error.~";

                      'vibrate', 'vibration': 
                         "~A certain amount of vibration within the system is unavoidable
                         and is completely normal.  However, certain larger amounts can
                         indicate dangerous levels of uncertainty within the system, and
                         should be avoided.~";

                      'wire': 
                         print "~Beginning with this model, production order receiving is
                           completely automated. An advanced communication system called ";
                         em("POTS");
                         print_ret " allows the system to receive orders electronically.
                           Orders are then immediately scheduled for production in the 
                           Order Processing Subsystem.~ ";

                      default:
                        print "The term ~";
                        for (j = 0: j < consult_words: ++j) {
                            c = WordAddress(consult_from + j);
                            for (i = 0: i < WordLength(consult_from + j): ++i) {
                                print (char) c->i;
                            }
                            if (j + 1 < consult_words)
                               print " ";
                        };
                        print_ret "~ doesn't appear in the manual's index or glossary.";
                    }
                  default:
                    "Consider it read.";
                }
            }
            else {
                "You can't read there from here.";
            }
          Open: 
            print "You open the manual. ";
            <<read intro>>;
          Close: "You close the manual.";
          Drop: "The technician said you are to use the manual to get the machine
                running, so you'd better hang on to it.";
        ];


Object  intro "Introduction" manual
  has   legible scenery,
  with  name 'introduction' 'intro' 'preface',
        found_in chamber atwindow atdoor,
        description [;
          <<Read self>>;
        ],
        before [;
          Read:
            print "The introduction is rather lengthy, so you turn to
              a random spot and begin reading...^";
            switch(random(3)) {
              1: print "~This model features separate subsystems which 
                   provide for order taking and production scheduling, 
                   on-demand manufacturing, and custom packaging and  
                   labeling.~^";
              2: print "~Because of the closed nature of the systems,
                   no cleanroom is required. This further reduces the
                   total cost of ownership.~^";
              3: print "~Serious injury or death may result from improper
                   operation and maintenance of the machine. Only qualified
                   professionals should be given access to the machine.~^";
            }
            rtrue;
          Consult:
            <<Consult manual>>;
        ]
;


Object  index "Index" manual
  has   legible scenery,
  with  name 'index' 'contents' 'topics' 'glossary',
        found_in chamber atwindow atdoor,
        description [;
          <<Read self>>;
        ],
        before [;
          Read:
            print "The index at the back of the Field Service Manual is a long
                  alphabetized list of topics and associated page numbers. You
                  try thinking of it as an aliterative poem about the machine, 
                  but quickly give up trying to read the entire index.
                  To use it, you can simply 
                  COMSULT MANUAL ABOUT <topic>.^";
            rtrue;
          Consult:
            <<Consult manual>>;
        ]
;
