cfad47cfa3/t3compiler/tads3/lib/adv3/en_us/instruct.t

4b825dc642cb6eb9a060e54bf8d69288fbee4904cfad47cfa334b206c65f22086bcc5d63e6f70944
1
#charset "us-ascii"
2
3
/* 
4
 *   Copyright (c) 2000, 2006 Michael J. Roberts.  All Rights Reserved. 
5
 *   
6
 *   TADS 3 Library: Instructions for new players
7
 *   
8
 *   This module defines the INSTRUCTIONS command, which provides the
9
 *   player with an overview of how to play IF games in general.  These
10
 *   instructions are especially designed as an introduction to IF for
11
 *   inexperienced players.  The instructions given here are meant to be
12
 *   general enough to apply to most games that follow the common IF
13
 *   conventions. 
14
 *   
15
 *   This module defines the English version of the instructions.
16
 *   
17
 *   In most cases, each author should customize these general-purpose
18
 *   instructions at least a little for the specific game.  We provide a
19
 *   few hooks for some specific parameter-driven customizations that don't
20
 *   require modifying the original text in this file.  Authors should also
21
 *   feel free to make more extensive customizations as needed to address
22
 *   areas where the game diverges from the common conventions described
23
 *   here.
24
 *   
25
 *   One of the most important things you should do to customize these
26
 *   instructions for your game is to add a list of any special verbs or
27
 *   command phrasings that your game uses.  Of course, you might think
28
 *   you'll be spoiling part of the challenge for the player if you do
29
 *   this; you might worry that you'll give away a puzzle if you don't keep
30
 *   a certain verb secret.  Be warned, though, that many players - maybe
31
 *   even most - don't think "guess the verb" puzzles are good challenges;
32
 *   a lot of players feel that puzzles that hinge on finding the right
33
 *   verb or phrasing are simply bad design that make a game less
34
 *   enjoyable.  You should think carefully about exactly why you don't
35
 *   want to disclose a particular verb in the instructions.  If you want
36
 *   to withhold a verb because the entire puzzle is to figure out what
37
 *   command to use, then you have created a classic guess-the-verb puzzle,
38
 *   and most everyone in the IF community will feel this is simply a bad
39
 *   puzzle that you should omit from your game.  If you want to withhold a
40
 *   verb because it's too suggestive of a particular solution, then you
41
 *   should at least make sure that a more common verb - one that you are
42
 *   willing to disclose in the instructions, and one that will make as
43
 *   much sense to players as your secret verb - can achieve the same
44
 *   result.  You don't have to disclose every *accepted* verb or phrasing
45
 *   - as long as you disclose every *required* verb *and* phrasing, you
46
 *   will have a defense against accusations of using guess-the-verb
47
 *   puzzles.
48
 *   
49
 *   You might also want to mention the "cruelty" level of the game, so
50
 *   that players will know how frequently they should save the game.  It's
51
 *   helpful to point out whether or not it's possible for the player
52
 *   character to be killed; whether it's possible to get into situations
53
 *   where the game becomes "unwinnable"; and, if the game can become
54
 *   unwinnable, whether or not this will become immediately clear.  The
55
 *   kindest games never kill the PC and are always winnable, no matter
56
 *   what actions the player takes; it's never necessary to save these
57
 *   games except to suspend a session for later resumption.  The cruelest
58
 *   games kill the PC without warning (although if they offer an UNDO
59
 *   command from a "death" prompt, then even this doesn't constitute true
60
 *   cruelty), and can become unwinnable in ways that aren't readily and
61
 *   immediately apparent to the player, which means that the player could
62
 *   proceed for quite some time (and thus invest substantial effort) after
63
 *   the game is already effectively lost.  Note that unwinnable situations
64
 *   can often be very subtle, and might not even be intended by the
65
 *   author; for example, if the player needs a candle to perform an
66
 *   exorcism at some point, but the candle can also be used for
67
 *   illumination in dark areas, the player could make the game unwinnable
68
 *   simply by using up the candle early on while exploring some dark
69
 *   tunnels, and might not discover the problem until much further into
70
 *   the game.  
71
 */
72
73
#include "adv3.h"
74
#include "en_us.h"
75
76
/*
77
 *   The INSTRUCTIONS command.  Make this a "system" action, because it's
78
 *   a meta-action outside of the story.  System actions don't consume any
79
 *   game time.  
80
 */
81
DefineSystemAction(Instructions)
82
    /*
83
     *   This property tells us how complete the verb list is.  By default,
84
     *   we'll assume that the instructions fail to disclose every required
85
     *   verb in the game, because the generic set we use here doesn't even
86
     *   try to anticipate the special verbs that most games include.  If
87
     *   you provide your own list of game-specific verbs, and your custom
88
     *   list (taken together with the generic list) discloses every verb
89
     *   required to complete the game, you should set this property to
90
     *   true; if you set this to true, the instructions will assure the
91
     *   player that they will not need to think of any verbs besides the
92
     *   ones listed in the instructions.  Authors are strongly encouraged
93
     *   to disclose a list of verbs that is sufficient by itself to
94
     *   complete the game, and to set this property to true once they've
95
     *   done so.  
96
     */
97
    allRequiredVerbsDisclosed = nil
98
99
    /* 
100
     *   A list of custom verbs.  Each game should set this to a list of
101
     *   single-quoted strings; each string gives an example of a verb to
102
     *   display in the list of sample verbs.  Something like this:
103
     *   
104
     *   customVerbs = ['brush my teeth', 'pick the lock'] 
105
     */
106
    customVerbs = []
107
108
    /* 
109
     *   Verbs relating specifically to character interaction.  This is in
110
     *   the same format as customVerbs, and has essentially the same
111
     *   purpose; however, we call these out separately to allow each game
112
     *   not only to supplement the default list we provide but to replace
113
     *   our default list.  This is desirable for conversation-related
114
     *   commands in particular because some games will not use the
115
     *   ASK/TELL conversation system at all and will thus want to remove
116
     *   any mention of the standard set of verbs.  
117
     */
118
    conversationVerbs =
119
    [
120
        'ASK WIZARD ABOUT WAND',
121
        'ASK WIZARD FOR POTION',
122
        'TELL WIZARD ABOUT DUSTY TOME',
123
        'SHOW SCROLL TO WIZARD',
124
        'GIVE WAND TO WIZARD',
125
        'YES (or NO)'
126
    ]
127
128
    /* conversation verb abbreviations */
129
    conversationAbbr = "\n\tASK ABOUT (topic) can be abbreviated
130
                        to A (topic)
131
                        \n\tTELL ABOUT (topic) can be entered as T (topic)"
132
133
    /*
134
     *   Truncation length. If the game's parser allows words to be
135
     *   abbreviated to some minimum number of letters, this should
136
     *   indicate the minimum length.  The English parser uses a truncation
137
     *   length of 6 letters by default.
138
     *   
139
     *   Set this to nil if the game doesn't allow truncation at all.  
140
     */
141
    truncationLength = 6
142
143
    /*
144
     *   This property should be set on a game-by-game basis to indicate
145
     *   the "cruelty level" of the game, which is a rough estimation of
146
     *   how likely it is that the player will encounter an unwinnable
147
     *   position in the game.
148
     *   
149
     *   Level 0 is "kind," which means that the player character can
150
     *   never be killed, and it's impossible to make the game unwinnable.
151
     *   When this setting is used, the instructions will reassure the
152
     *   player that saving is necessary only to suspend the session.
153
     *   
154
     *   Level 1 is "standard," which means that the player character can
155
     *   be killed, and/or that unwinnable positions are possible, but
156
     *   that there are no especially bad unwinnable situations.  When
157
     *   this setting is selected, we'll warn the player that they should
158
     *   save every so often.
159
     *   
160
     *   (An "especially bad" situation is one in which the game becomes
161
     *   unwinnable at some point, but this won't become apparent to the
162
     *   player until much later.  For example, suppose the first scene
163
     *   takes place in a location that can never be reached again after
164
     *   the first scene, and suppose that there's some object you can
165
     *   obtain in this scene.  This object will be required in the very
166
     *   last scene to win the game; if you don't have the object, you
167
     *   can't win.  This is an "especially bad" unwinnable situation: if
168
     *   you leave the first scene without getting the necessary object,
169
     *   the game is unwinnable from that point forward.  In order to win,
170
     *   you have to go back and play almost the whole game over again.
171
     *   Saved positions are almost useless in a case like this, since
172
     *   most of the saved positions will be after the fatal mistake; no
173
     *   matter how often you saved, you'll still have to go back and do
174
     *   everything over again from near the beginning.)
175
     *   
176
     *   Level 2 is "cruel," which means that the game can become
177
     *   unwinnable in especially bad ways, as described above.  If this
178
     *   level is selected, we'll warn the player more sternly to save
179
     *   frequently.
180
     *   
181
     *   We set this to 1 ("standard") by default, because even games that
182
     *   aren't intentionally designed to be cruel often have subtle
183
     *   situations where the game becomes unwinnable, because of things
184
     *   like the irreversible loss of an object, or an unrepeatable event
185
     *   sequence; it almost always takes extra design work to ensure that
186
     *   a game is always winnable.  
187
     */
188
    crueltyLevel = 1
189
190
    /*
191
     *   Does this game have any real-time features?  If so, set this to
192
     *   true.  By default, we'll explain that game time passes only in
193
     *   response to command input. 
194
     */
195
    isRealTime = nil
196
197
    /*
198
     *   Conversation system description.  Several different conversation
199
     *   systems have come into relatively widespread use, so there isn't
200
     *   any single convention that's generic enough that we can assume it
201
     *   holds for all games.  In deference to this variability, we
202
     *   provide this hook to make it easy to replace the instructions
203
     *   pertaining to the conversation system.  If the game uses the
204
     *   standard ASK/TELL system, it can leave this list unchanged; if
205
     *   the game uses a different system, it can replace this with its
206
     *   own instructions.
207
     *   
208
     *   We'll include information on the TALK TO command if there are any
209
     *   in-conversation state objects in the game; if not, we'll assume
210
     *   there's no need for this command.
211
     *   
212
     *   We'll mention the TOPICS command if there are any SuggestedTopic
213
     *   instances in the game; if not, then the game will never have
214
     *   anything to suggest, so the TOPICS command isn't needed.
215
     *   
216
     *   We'll include information on special topics if there are any
217
     *   SpecialTopic objects defined.  
218
     */
219
    conversationInstructions =
220
        "You can talk to other characters by asking or
221
        telling them about things in the story.  For example, you might
222
        ASK WIZARD ABOUT WAND or TELL GUARD ABOUT ALARM.  You should
223
        always use the ASK ABOUT or TELL ABOUT phrasing; the story
224
        won’t be able to understand other formats, so you don’t
225
        have to worry about thinking up complicated questions like <q>ask
226
        guard how to open the window.</q>
227
        In most cases, you&rsquo;ll get the best results by asking
228
        about specific objects or other characters you&rsquo;ve encountered
229
        in the story, rather than about abstract topics such as
230
        MEANING OF LIFE; however, if something in the story leads you
231
        to believe you <i>should</i> ask about some particular abstract
232
        topic, it can&rsquo;t hurt to try.
233
234
        \bIf you&rsquo;re asking or telling the same person about several
235
        topics in succession, you can save some typing by abbreviating
236
        ASK ABOUT to A, and TELL ABOUT to T.  For example, once you&rsquo;re
237
        talking to the wizard, you can abbreviate ASK WIZARD ABOUT AMULET
238
        to simply A AMULET.  This addresses the question to the same
239
        character as in the last ASK or TELL.
240
241
        <<firstObj(InConversationState, ObjInstances) != nil ?
242
          "\bTo greet another character, type TALK TO (Person).  This
243
          tries to get the other character&rsquo;s attention and start a
244
          conversation.  TALK TO is always optional, since you can start
245
          in with ASK or TELL directly if you prefer." : "">>
246
247
        <<firstObj(SpecialTopic, ObjInstances) != nil ?
248
          "\bThe story might occasionally suggest some special conversation
249
          commands, like this:
250
251
          \b\t(You could apologize, or explain about the aliens.)
252
253
          \bIf you like, you can use one of the suggestions just by
254
          typing in the special phrasing shown.  You can usually
255
          abbreviate these to the first few words when they&rsquo;re long.
256
257
          \b\t&gt;APOLOGIZE
258
          \n\t&gt;EXPLAIN ABOUT ALIENS
259
260
          \bSpecial suggestions like this only work right at the moment
261
          they&rsquo;re offered, so you don&rsquo;t have to worry about
262
          memorizing them, or trying them at other random times in the story.
263
          They&rsquo;re not new commands for you to learn; they&rsquo;re just
264
          extra options you have at specific times, and the story will always
265
          let you know when they&rsquo;re available.  When the story offers
266
          suggestions like this, they don&rsquo;t limit what you can do; you
267
          can still type any ordinary command instead of one of the
268
          suggestions." : "">>
269
270
        <<firstObj(SuggestedTopic, ObjInstances) != nil ?
271
          "\bIf you&rsquo;re not sure what to discuss, you can type TOPICS any
272
          time you&rsquo;re talking to someone.  This will show you a list of
273
          things that your character might be interested in discussing
274
          with the other person.  The TOPICS command usually won&rsquo;t list
275
          everything that you can discuss, so feel free to explore other
276
          topics even if they&rsquo;re not listed." : "">>
277
278
        \bYou can also interact with other characters using physical
279
        objects.  For example, you might be able to give something to
280
        another character, as in GIVE MONEY TO CLERK, or show an object
281
        to someone, as in SHOW IDOL TO PROFESSOR.  You might also be
282
        able to fight other characters, as in ATTACK TROLL WITH
283
        SWORD or THROW AXE AT DWARF.
284
285
        \bIn some cases, you can tell a character to do
286
        something for you.  You do this by typing the character&rsquo;s name,
287
        then a comma, then the command you want the character to perform,
288
        using the same wording you&rsquo;d use for a command to your own
289
        character.  For example:
290
291
        \b\t&gt;ROBOT, GO NORTH
292
293
        \bKeep in mind, though, that there&rsquo;s no guarantee that other
294
        characters will always obey your orders.  Most characters have
295
        minds of their own and won&rsquo;t automatically do whatever you
296
        ask. "
297
298
    /* execute the command */
299
    execSystemAction()
300
    {
301
        local origElapsedTime;
302
303
        /* 
304
         *   note the elapsed game time on the real-time clock before we
305
         *   start, so that we can reset the game time when we're done; we
306
         *   don't want the instructions display to consume any real game
307
         *   time 
308
         */
309
        origElapsedTime = realTimeManager.getElapsedTime();
310
311
        /* show the instructions */
312
        showInstructions();
313
314
        /* reset the real-time game clock */
315
        realTimeManager.setElapsedTime(origElapsedTime);
316
    }
317
318
#ifdef INSTRUCTIONS_MENU
319
    /*
320
     *   Show the instructions, using a menu-based table of contents.
321
     */
322
    showInstructions()
323
    {
324
        /* run the instructions menu */
325
        topInstructionsMenu.display();
326
327
        /* show an acknowledgment */
328
        "Done. ";
329
    }
330
    
331
#else /* INSTRUCTIONS_MENU */
332
333
    /*
334
     *   Show the instructions as a standard text display.  Give the user
335
     *   the option of turning on a SCRIPT file to capture the text.  
336
     */
337
    showInstructions()
338
    {
339
        local startedScript;
340
341
        /* presume we won't start a new script file */
342
        startedScript = nil;
343
        
344
        /* show the introductory message */
345
        "The story is about to show a full set of instructions,
346
        designed especially for people who aren&rsquo;t already familiar
347
        with interactive fiction.  The instructions are lengthy";
348
349
        /*
350
         *   Check to see if we're already scripting.  If we aren't, offer
351
         *   to save the instructions to a file. 
352
         */
353
        if (scriptStatus.scriptFile == nil)
354
        {
355
            local str;
356
            
357
            /* 
358
             *   they're not already logging; ask if they'd like to start
359
             *   doing so 
360
             */
361
            ", so you might want to capture them to a file (so that
362
            you can print them out, for example).  Would you like to
363
            proceed?
364
            \n(<a href='yes'>Y</a> is affirmative, or type
365
            <a href='script'>SCRIPT</a> to capture to
366
            a file) &gt; ";
367
368
            /* ask for input */
369
            str = inputManager.getInputLine(nil, nil);
370
371
            /* if they want to capture them to a file, set up scripting */
372
            if (rexMatch('<nocase><space>*s(c(r(i(pt?)?)?)?)?<space>*', str)
373
                == str.length())
374
            {
375
                /* try setting up a scripting file */
376
                ScriptAction.setUpScripting(nil);
377
378
                /* if that failed, don't proceed */
379
                if (scriptStatus.scriptFile == nil)
380
                    return;
381
                
382
                /* note that we've started a script file */
383
                startedScript = true;
384
            }
385
            else if (rexMatch('<nocase><space>*y.*', str) != str.length())
386
            {
387
                "Canceled. ";
388
                return;
389
            }
390
        }
391
        else
392
        {
393
            /* 
394
             *   they're already logging; just confirm that they want to
395
             *   see the instructions 
396
             */
397
            "; would you like to proceed?
398
            \n(Y is affirmative) &gt; ";
399
400
            /* stop if they don't want to proceed */
401
            if (!yesOrNo())
402
            {
403
                "Canceled. ";
404
                return;
405
            }
406
        }
407
408
        /* make sure we have something for the next "\b" to skip from */
409
        "\ ";
410
411
        /* show each chapter in turn */
412
        showCommandsChapter();
413
        showAbbrevChapter();
414
        showTravelChapter();
415
        showObjectsChapter();
416
        showConversationChapter();
417
        showTimeChapter();
418
        showSaveRestoreChapter();
419
        showSpecialCmdChapter();
420
        showUnknownWordsChapter();
421
        showAmbiguousCmdChapter();
422
        showAdvancedCmdChapter();
423
        showTipsChapter();
424
425
        /* if we started a script file, close it */
426
        if (startedScript)
427
            ScriptOffAction.turnOffScripting(nil);
428
    }
429
430
#endif /* INSTRUCTIONS_MENU */
431
432
    /* Entering Commands chapter */
433
    showCommandsChapter()
434
    {
435
        "\b<b>Entering Commands</b>\b
436
        You&rsquo;ve probably already noticed that you interact with the story
437
        by typing a command whenever you see the <q>prompt,</q> which
438
        usually looks like this:
439
        \b";
440
441
        gLibMessages.mainCommandPrompt(rmcCommand);
442
443
        "\bKnowing this much, you&rsquo;re probably thinking one of two things:
444
        <q>Great, I can type absolutely anything I want, in plain English,
445
        and the story will do my bidding,</q> or <q>Great, now I have to
446
        figure out yet another heinously complex command language for
447
        a computer program; I think I&rsquo;ll go play Minefield.</q>  Well,
448
        neither extreme is quite true.
449
450
        \bIn actual play, you&rsquo;ll only need a fairly small set of
451
        commands, and the commands are mostly in ordinary English, so
452
        there&rsquo;s not very much you&rsquo;ll have to learn or remember.
453
        Even though that command prompt can look intimidating, don&rsquo;t
454
        let it scare you off &mdash; there are just a few simple things you
455
        have to know.
456
457
        \bFirst, you&rsquo;ll almost never have to refer to anything that
458
        isn&rsquo;t directly mentioned in the story; this is a story, after
459
        all, not a guessing game where you have to think of everything that
460
        goes together with some random object.  For example, if
461
        you&rsquo;re wearing a jacket, you might assume that the jacket has
462
        pockets, or buttons, or a zipper &mdash; but if the story never
463
        mentions those things, you shouldn&rsquo;t have to worry about them.
464
465
        \bSecond, you won&rsquo;t have to think of every conceivable action
466
        you could perform.  The point of the game isn&rsquo;t to make you
467
        guess at verbs.  Instead, you&rsquo;ll only have to use a relatively
468
        small number of simple, ordinary actions.  To give you an idea
469
        of what we mean, here are some of the commands you can use:";
470
        
471
        "\b
472
        \n\t LOOK AROUND
473
        \n\t INVENTORY
474
        \n\t GO NORTH (or EAST, SOUTHWEST, and so on, or UP, DOWN, IN, OUT)
475
        \n\t WAIT
476
        \n\t TAKE THE BOX
477
        \n\t DROP THE DISK
478
        \n\t LOOK AT THE DISK
479
        \n\t READ THE BOOK
480
        \n\t OPEN BOX
481
        \n\t CLOSE BOX
482
        \n\t LOOK IN THE BOX
483
        \n\t LOOK THROUGH WINDOW
484
        \n\t PUT FLOPPY DISK INTO BOX
485
        \n\t PUT BOX ON TABLE
486
        \n\t WEAR THE CONICAL HAT
487
        \n\t TAKE OFF HAT
488
        \n\t TURN ON LANTERN
489
        \n\t LIGHT MATCH
490
        \n\t LIGHT CANDLE WITH MATCH
491
        \n\t PUSH BUTTON
492
        \n\t PULL LEVER
493
        \n\t TURN KNOB
494
        \n\t TURN DIAL TO 11
495
        \n\t EAT COOKIE
496
        \n\t DRINK MILK
497
        \n\t THROW PIE AT CLOWN
498
        \n\t ATTACK TROLL WITH SWORD
499
        \n\t UNLOCK DOOR WITH KEY
500
        \n\t LOCK DOOR WITH KEY
501
        \n\t CLIMB THE LADDER
502
        \n\t GET IN THE CAR
503
        \n\t SIT ON THE CHAIR
504
        \n\t STAND ON THE TABLE
505
        \n\t STAND IN FLOWER BED
506
        \n\t LIE ON THE BED
507
        \n\t TYPE HELLO ON COMPUTER
508
        \n\t LOOK UP BOB IN PHONE BOOK";
509
510
        /* show the conversation-related verbs */
511
        foreach (local cur in conversationVerbs)
512
            "\n\t <<cur>>";
513
514
        /* show the custom verbs */
515
        foreach (local cur in customVerbs)
516
            "\n\t <<cur>>";
517
518
        /* 
519
         *   if the list is exhaustive, say so; otherwise, mention that
520
         *   there might be some other verbs to find 
521
         */
522
        if (allRequiredVerbsDisclosed)
523
            "\bThat&rsquo;s it &mdash; every verb and every command phrasing
524
            you need to complete the story is shown above.
525
            If you ever get stuck and feel like the story is expecting
526
            you to think of something completely out of the blue, remember
527
            this: whatever it is you have to do, you can do it with one
528
            or more of the commands shown above. 
529
            Don&rsquo;t ever worry that you have to start trying lots of
530
            random commands to hit upon the magic phrasing, because
531
            everything you need is shown plainly above. ";
532
        else
533
            "\bMost of the verbs you&rsquo;ll need to complete the story are
534
            shown above; there might be a few additional commands you&rsquo;ll
535
            need from time to time as well, but they&rsquo;ll follow the same
536
            simple format as the commands above.";
537
538
        "\bA few of these commands deserve some more explanation.
539
        LOOK AROUND (which you abbreviate to LOOK, or even just L)
540
        shows the description of the current location.  You can use
541
        this if you want to refresh your memory of your character&rsquo;s
542
        surroundings.  INVENTORY (or just I) shows a list of everything
543
        your character is carrying. WAIT (or Z) just lets a little
544
        time pass in the story.";
545
    }
546
547
    /* Abbreviations chapter */
548
    showAbbrevChapter()
549
    {
550
        "\b<b>Abbreviations</b>
551
        \bYou&rsquo;ll probably use a few commands quite a lot, so to save
552
        typing, you can abbreviate some of the most frequently-used
553
        commands:
554
555
        \b
556
        \n\t LOOK AROUND can be shortened to LOOK, or merely L
557
        \n\t INVENTORY can be simply I
558
        \n\t GO NORTH can be written NORTH, or even just N (likewise E, W, S,
559
            NE, SE, NW, SW, U for UP and D for DOWN)
560
        \n\t LOOK AT THE DISK can be entered as EXAMINE DISK or simply X DISK
561
        \n\t WAIT can be shortened to Z
562
        <<conversationAbbr>>
563
564
        \b<b>A Few More Command Details</b>
565
        \bWhen you&rsquo;re entering commands, you can use capital or small
566
        letters in any mixture.  You can use words such as THE and A
567
        when they&rsquo;re appropriate, but you can omit them if you
568
        prefer. ";
569
570
        if (truncationLength != nil)
571
        {
572
            "You can abbreviate any word to its first <<
573
            spellInt(truncationLength)>> letters, but if you choose not
574
            to abbreviate, the story will pay attention to
575
            everything you actually type; this means, for example, that you
576
            can abbreviate SUPERCALIFRAGILISTICEXPIALIDOCIOUS to <<
577
            'SUPERCALIFRAGILISTICEXPIALIDOCIOUS'.substr(1, truncationLength)
578
            >> or <<
579
            'SUPERCALIFRAGILISTICEXPIALIDOCIOUS'.substr(1, truncationLength+2)
580
            >>, but not to <<
581
            'SUPERCALIFRAGILISTICEXPIALIDOCIOUS'.substr(1, truncationLength)
582
            >>SDF. ";
583
        }
584
    }
585
586
    /* Travel chapter */
587
    showTravelChapter()
588
    {
589
        "\b<b>Travel</b>
590
        \bAt any given time in the story, your character is in a
591
        <q>location.</q>  The story describes the location when your
592
        character first enters, and again any time you type LOOK.
593
        Each location usually has a short name that&rsquo;s displayed just
594
        before its full description; the name is useful when drawing a map,
595
        and the short name can help jog your memory as you&rsquo;re finding
596
        your way around.
597
598
        \bEach location is a separate room, or a large outdoor area,
599
        or the like.  (Sometimes a single physical room is so large that
600
        it comprises several locations in the game, but that&rsquo;s fairly
601
        rare.)  For the most part, going to a location is as specific
602
        as you have to get about travel; once your character is in a
603
        location, the character can usually see and reach everything
604
        within the location, so you don&rsquo;t have to worry about where
605
        exactly your character is standing within the room.  Once in
606
        a while, you might find that something is out of reach, perhaps
607
        because it&rsquo;s on a high shelf or on the other side of a moat; in
608
        these cases, it&rsquo;s sometimes useful to be more specific about
609
        your character&rsquo;s location, such as by standing on something
610
        (STAND ON TABLE, for example).
611
612
        \bTraveling from one location to another is usually done using
613
        a direction command: GO NORTH, GO NORTHEAST, GO UP, and so on.
614
        (You can abbreviate the cardinal and vertical directions to one
615
        letter each &mdash; N, S, E, W, U, D &mdash; and the diagonal
616
        directions to two: NE, NW, SE, SW.)  The story should always
617
        tell you the directions that you can go when it describes a
618
        location, so you should never have to try all the unmentioned
619
        directions to see if they go anywhere.
620
621
        \bIn most cases, backtracking (by reversing the direction you
622
        took from one location to another) will take you back to where you
623
        started, although some passages might have turns.
624
625
        \bMost of the time, when the story describes a door or passageway,
626
        you won&rsquo;t need to open the door to go through the passage, as
627
        the story will do this for you.  Only when the story specifically
628
        states that a door is blocking your way will you usually have to
629
        deal with the door explicitly.";
630
    }
631
632
    /* Objects chapter */
633
    showObjectsChapter()
634
    {
635
        "\b<b>Manipulating Objects</b>
636
        \bYou might find objects in the story that your character can
637
        carry or otherwise manipulate.  If you want to carry something,
638
        type TAKE and the object&rsquo;s name: TAKE BOOK.  If you want to
639
        drop something your character is carrying, DROP it.
640
641
        \bYou usually won&rsquo;t have to be very specific about exactly
642
        how your character is supposed to carry or hold something, so you
643
        shouldn&rsquo;t have to worry about which hand is holding which item
644
        or anything like that.  It might sometimes be useful to put one
645
        object inside or on top of another, though; for example, PUT BOOK
646
        IN SHOPPING BAG or PUT VASE ON TABLE.  If your character&rsquo;s
647
        hands get full, it might help to put some items being carried
648
        into a container, much as in real life you can carry more stuff
649
        if it&rsquo;s in a bag or a box.
650
651
        \bYou can often get a lot of extra information (and sometimes 
652
        vital clues) by examining objects, which you can do with the LOOK
653
        AT command (or, equivalently, EXAMINE, which you can abbreviate
654
        to simply X, as in X PAINTING).  Most experienced players get
655
        in the habit of examining everything in a new location right
656
        away. ";
657
    }
658
659
    /* show the Conversation chapter */
660
    showConversationChapter()
661
    {
662
        "\b<b>Interacting with Other Characters</b>
663
        \bYour character may encounter other people or creatures in the
664
        story.  You can sometimes interact with these characters.\b";
665
666
        /* show the customizable conversation instructions */
667
        conversationInstructions;
668
    }
669
670
    /* Time chapter */
671
    showTimeChapter()
672
    {
673
        "\b<b>Time</b>";
674
675
        if (isRealTime)
676
        {
677
            "\bTime passes in the story in response to the commands
678
            you type.  In addition, some parts of the story
679
            might unfold in <q>real time,</q> which means that things
680
            can happen even while you&rsquo;re thinking about your next move.
681
682
            \bIf you want to stop the clock while you&rsquo;re away from your
683
            computer for a moment (or you just need some time to think),
684
            you can type PAUSE.";
685
        }
686
        else
687
        {
688
            "\bTime passes in the story only in response to commands
689
            you type.  This means that nothing happens while the story
690
            is waiting for you to type something.  Each command takes
691
            about the same amount of time in the story.  If you
692
            specifically want to let some extra time pass within the
693
            story, because you think something is about to happen,
694
            you can type WAIT (or just Z). ";
695
        }
696
    }
697
698
    /* Saving, Restoring, and Undo chapter */
699
    showSaveRestoreChapter()
700
    {
701
        "\b<b>Saving and Restoring</b>
702
        \bYou can save a snapshot of your current position in the story
703
        at any time, so that you can later restore the story to the
704
        same position.  The snapshot will be saved to a file on your
705
        computer&rsquo;s disk, and you can save as many different snapshots
706
        as you&rsquo;d like (to the extent you have space on your disk,
707
        anyway).\b";
708
709
        switch (crueltyLevel)
710
        {
711
        case 0:
712
            "In this story, your character will never be killed, and
713
            you&rsquo;ll never find yourself in a situation where
714
            it&rsquo;s impossible to complete the story.  Whatever happens
715
            to your character, you&rsquo;ll always be able to find a way
716
            to complete the story. So, unlike in many text games, you
717
            don&rsquo;t have to worry about saving positions to protect
718
            yourself against getting stuck in impossible situations.  Of
719
            course, you can still save as often as you&rsquo;d like, to
720
            suspend your session and return to it later, or to save
721
            positions that you think you might want to revisit.";
722
            break;
723
724
        case 1:
725
        case 2:
726
            "It might be possible for your character to be killed in
727
            the story, or for you to find your character in an impossible
728
            situation where you won&rsquo;t be able to complete the story.
729
            So, you should be sure to save your position
730
            <<crueltyLevel == 1 ? 'from time to time' : 'frequently'>>
731
            so that you won&rsquo;t have to go back too far if this should
732
            happen. ";
733
734
            if (crueltyLevel == 2)
735
                "(You should make a point of keeping all of your old saved
736
                positions, too, because you might not always realize
737
                immediately when a situation has become impossible.
738
                You might find at times that you need to go back further
739
                than just the last position that you <i>thought</i>
740
                was safe.)";
741
742
            break;
743
        }
744
745
        "\bTo save your position, type SAVE at the command prompt.
746
        The story will ask you for the name of a disk file to use to store
747
        snapshot.  You&rsquo;ll have to specify a filename suitable for
748
        your computer system, and the disk will need enough free space
749
        to store the file; you&rsquo;ll be told if there&rsquo;s any problem
750
        saving the file.  You should use a filename that doesn&rsquo;t already
751
        exist on your machine, because the new file will overwrite any
752
        existing file with the same name.
753
754
        \bYou can restore a previously saved position by typing RESTORE
755
        at any prompt.  The story will ask you for the name of the file
756
        to restore.  After the computer reads the file, everything in
757
        the story will be exactly as it was when you saved that file.";
758
759
        "\b<b>Undo</b>
760
        \bEven if you haven&rsquo;t saved your position recently, you can
761
        usually take back your last few commands with the UNDO command.
762
        Each time you type UNDO, the story reverses the effect of one command,
763
        restoring the story as it was before you typed that command.  UNDO
764
        is limited to taking back the last few commands, so this isn&rsquo;t
765
        a substitute for SAVE/RESTORE, but it&rsquo;s very handy if you
766
        find your character unexpectedly in a dangerous situation, or you
767
        make a mistake you want to take back.";
768
    }
769
770
    /* Other Special Commands chapter */
771
    showSpecialCmdChapter()
772
    {
773
        "\b<b>Some Other Special Commands</b>
774
        \bThe story understands a few other special commands that
775
        you might find useful.
776
777
        \bAGAIN (or just G): Repeats the last command.  (If your last input
778
        line had several commands, only the last single command on the line
779
        is repeated.)
780
        \bINVENTORY (or just I): Shows what your character is carrying.
781
        \bLOOK (or just L): Shows the full description of your
782
        character&rsquo;s current location.";
783
784
        /* if the exit lister module is active, mention the EXITS command */
785
        if (gExitLister != nil)
786
            "\bEXITS: Shows the list of obvious exits from the current
787
            location.
788
            \bEXITS ON/OFF/STATUS/LOOK: Controls the way the game
789
            displays exit lists.  EXITS ON puts a list of
790
            exits in the status line and also lists exits in each room
791
            description.  EXITS OFF turns off both of these listings.
792
            EXITS STATUS turns on just the status line exit list, and
793
            EXITS ROOM turns on only the room description lists.";
794
        
795
        "\bOOPS: Corrects a single misspelled word in a command, without
796
        retyping the entire command.  You can only use OOPS immediately
797
        after the story tells you it didn&rsquo;t recognize a word in your
798
        previous command.  Type OOPS followed by the corrected word.
799
        \bQUIT (or just Q): Terminates the story.
800
        \bRESTART: Starts the story over from the beginning.
801
        \bRESTORE: Restores a position previously saved with SAVE.
802
        \bSAVE: Saves the current position in a disk file.
803
        \bSCRIPT: Starts making a transcript of your story session,
804
        saving all of the displayed text to a disk file, so that you
805
        can peruse it later or print it out.
806
        \bSCRIPT OFF: Ends a transcript that you started with SCRIPT. 
807
        \bUNDO: Takes back the last command.
808
        \bSAVE DEFAULTS: Saves your current settings for things like
809
        NOTIFY, EXITS, and FOOTNOTES as defaults.  This means that your
810
        settings will be restored automatically the next time you start
811
        a new game, or RESTART this one.
812
        \bRESTORE DEFAULTS: Explicitly restores the option settings
813
        you previously saved with SAVE DEFAULTS. ";
814
    }
815
    
816
    /* Unknown Words chapter */
817
    showUnknownWordsChapter()
818
    {
819
        "\b<b>Unknown Words</b>
820
        \bThe story doesn&rsquo;t pretend to know every word in the English
821
        language.  The story might even occasionally use words in its
822
        own descriptions that it doesn&rsquo;t understand in commands.  If
823
        you type a command with a word the story doesn&rsquo;t know, the
824
        story will tell you which word it didn&rsquo;t recognize.  If the
825
        story doesn&rsquo;t know a word for something it described, and
826
        it doesn&rsquo;t know any synonyms for that thing, you can probably
827
        assume that the object is just there as a detail of the setting,
828
        and isn&rsquo;t important to the story. ";
829
    }
830
831
    /* Ambiguous Commands chapter */
832
    showAmbiguousCmdChapter()
833
    {
834
        "\b<b>Ambiguous Commands</b>
835
        \bIf you type a command that leaves out some important information,
836
        the story will try its best to figure out what you mean.  Whenever
837
        it&rsquo;s reasonably obvious from context what you mean, the story
838
        will make an assumption about the missing information and proceed
839
        with the command.  The story will point out what it&rsquo;s assuming
840
        in these cases, to avoid any confusion from a mismatch between the
841
        story&rsquo;s assumptions and yours.  For example:
842
843
        \b
844
        \n\t &gt;TIE THE ROPE
845
        \n\t (to the hook)
846
        \n\t The rope is now tied to the hook.  The end of the
847
        \n\t rope nearly reaches the floor of the pit below.
848
        
849
        \bIf the command is ambiguous enough that the story can&rsquo;t
850
        safely make an assumption, you&rsquo;ll be asked for more
851
        information.  You can answer these questions by typing the
852
        missing information.
853
854
        \b
855
        \n\t &gt;UNLOCK THE DOOR
856
        \n\t What do you want to unlock it with?
857
        \b
858
        \n\t &gt;KEY
859
        \n\t Which key do you mean, the gold key, or the silver key?
860
        \b
861
        \n\t &gt;GOLD
862
        \n\t Unlocked.
863
864
        \bIf the story asks you one of these questions, and you decide
865
        that you don&rsquo;t want to proceed with the original command after
866
        all, you can just type in a brand new command instead of answering
867
        the question.";
868
    }
869
870
    /* Advance Command Formats chapter */
871
    showAdvancedCmdChapter()
872
    {
873
        "\b<b>Advanced Command Formats</b>
874
        \bOnce you get comfortable with entering commands, you might
875
        be interested to know about some more complex command formats
876
        that the story will accept.  These advanced commands are all
877
        completely optional, because you can always do the same things
878
        with the simpler formats we&rsquo;ve talked about so far, but
879
        experienced players often like the advanced formats because
880
        they can save you a little typing.
881
882
        \b<b>Using Multiple Objects at Once</b>
883
        \bIn most commands, you can operate on multiple objects in
884
        a single command.  Use the word AND, or a comma, to separate
885
        one object from another:
886
887
        \b
888
        \n\t TAKE THE BOX, THE FLOPPY DISK, AND THE ROPE
889
        \n\t PUT DISK AND ROPE IN BOX
890
        \n\t DROP BOX AND ROPE
891
        
892
        \bYou can use the words ALL and EVERYTHING to refer to everything
893
        applicable to your command, and you can use EXCEPT or BUT
894
        (right after the word ALL) to exclude specific objects:
895
896
        \b
897
        \n\t TAKE ALL
898
        \n\t PUT ALL BUT DISK AND ROPE INTO BOX
899
        \n\t TAKE EVERYTHING OUT OF THE BOX
900
        \n\t TAKE ALL OFF SHELF
901
902
        \bALL refers to everything that makes sense for your command,
903
        excluding things inside other objects matching the ALL.  For example,
904
        if you&rsquo;re carrying a box and a rope, and the box contains
905
        a floppy disk, typing DROP ALL will drop the box and the rope,
906
        and the floppy will remain in the box.
907
908
        \b<b><q>It</q> and <q>Them</q></b>
909
        \bYou can use IT and THEM to refer to the last object or objects
910
        that you used in a command:
911
912
        \b
913
        \n\t TAKE THE BOX
914
        \n\t OPEN IT
915
        \n\t TAKE THE DISK AND THE ROPE
916
        \n\t PUT THEM IN THE BOX
917
918
        \b<b>Multiple Commands At Once</b>
919
        \bYou can put multiple commands on a single input line by
920
        separating the commands with periods or the word THEN, or
921
        with a comma or AND.  For example:
922
923
        \b
924
        \n\t TAKE THE DISK AND PUT IT IN THE BOX
925
        \n\t TAKE BOX. OPEN IT.
926
        \n\t UNLOCK THE DOOR WITH THE KEY. OPEN IT, THEN GO NORTH.
927
928
        \b If the story doesn&rsquo;t understand one of the commands, it will
929
        tell you what it couldn&rsquo;t understand, and ignore everything after
930
        that on the line.";
931
    }
932
933
    /* General Tips chapter */
934
    showTipsChapter()
935
    {
936
        "\b<b>A Few Tips</b>
937
        \bNow that you know the technical details of entering commands,
938
        you might be interested in some strategy pointers.  Here are
939
        a few techniques that experienced interactive fiction players use
940
        when approaching a story.
941
942
        \bEXAMINE everything, especially when you enter a new location
943
        for the first time.  Looking at objects will often reveal details
944
        that aren&rsquo;t mentioned in the broader description of the location.
945
        If examining an object mentions detailed parts of the object,
946
        examine them as well.
947
948
        \bMake a map, if the story has more than a few locations.  When
949
        you encounter a new location for the first time, note all of its
950
        exits; this will make it easy to see at a glance if there are any
951
        exits you haven&rsquo;t explored yet.  If you get stuck, you can scan
952
        your map for any unexplored areas, where you might find what
953
        you&rsquo;re looking for.
954
955
        \bIf the story doesn&rsquo;t recognize a word or any of its synonyms,
956
        the object you&rsquo;re trying to manipulate probably isn&rsquo;t
957
        important to the story.  If you try manipulating something, and the
958
        story responds with something like <q>that isn&rsquo;t important,</q>
959
        you can probably just ignore the object; it&rsquo;s most likely just
960
        there as scenery, to make the setting more detailed.
961
962
        \bIf you&rsquo;re trying to accomplish something, and nothing you do
963
        seems to work, pay attention to what&rsquo;s going wrong.  If
964
        everything you try is met with utter dismissal (<q>nothing
965
        happens</q> or <q>that&rsquo;s not something you can open</q>), you
966
        might simply be on the wrong track; step back and think about other
967
        ways of approaching the problem.  If the response is something more
968
        specific, it might be a clue. <q>The guard says <q>you can&rsquo;t
969
        open that here!</q>\ and snatches the box from your hands</q> &emdash;
970
        this might indicate that you have to get the guard to leave, or
971
        that you should take the box somewhere else before you open it,
972
        for example.
973
974
        \bIf you get completely stuck, you might try setting aside the
975
        current puzzle and working on a different problem for a while.
976
        You might even want to save your position and take a break from
977
        the game.  The solution to the problem that&rsquo;s been
978
        thwarting your progress might come to you in a flash of insight
979
        when you least expect it, and those moments of insight can be
980
        incredibly rewarding.  Some stories are best appreciated when
981
        played over a period of days, weeks, or even months; if you&rsquo;re
982
        enjoying the story, why rush through it?
983
984
        \bFinally, if all else fails, you can try asking for help.  A
985
        great place to go for hints is the Usenet newsgroup
986
        <a href='news:rec.games.int-fiction'>rec.games.int-fiction</a>. ";
987
988
        "\n";
989
    }
990
991
    /* INSTRUCTIONS doesn't affect UNDO or AGAIN */
992
    isRepeatable = nil
993
    includeInUndo = nil
994
;
995
996
997
/* ------------------------------------------------------------------------ */
998
/*
999
 *   define the INSTRUCTIONS command's grammar 
1000
 */
1001
VerbRule(instructions) 'instructions' : InstructionsAction
1002
;
1003
1004
1005
/* ------------------------------------------------------------------------ */
1006
/*
1007
 *   The instructions, rendered in menu form.  The menu format helps break
1008
 *   up the instructions by dividing the instructions into chapters, and
1009
 *   displaying a menu that lists the chapters.  This way, players can
1010
 *   easily go directly to the chapters they're most interested in, but
1011
 *   can also still read through the whole thing fairly easily.
1012
 *   
1013
 *   To avoid creating an unnecessary dependency on the menu subsystem for
1014
 *   games that don't want the menu-style instructions, we'll only define
1015
 *   the menu objects if the preprocessor symbol INSTRUCTIONS_MENU is
1016
 *   defined.  So, if you want to use the menu-style instructions, just
1017
 *   add -D INSTRUCTIONS_MENU to your project makefile.  
1018
 */
1019
#ifdef INSTRUCTIONS_MENU
1020
1021
/* a base class for the instruction chapter menus */
1022
class InstructionsMenu: MenuLongTopicItem
1023
    /* 
1024
     *   present the instructions in "chapter" format, so that we can
1025
     *   navigate from one chapter directly to the next 
1026
     */
1027
    isChapterMenu = true
1028
1029
    /* the InstructionsAction property that we invoke to show our chapter */
1030
    chapterProp = nil
1031
1032
    /* don't use a heading, as we provide our own internal chapter titles */
1033
    heading = ''
1034
1035
    /* show our chapter text */
1036
    menuContents = (InstructionsAction.(self.chapterProp)())
1037
;
1038
1039
InstructionsMenu template 'title' ->chapterProp;
1040
1041
/*
1042
 *   The main instructions menu.  This can be used as a top-level menu;
1043
 *   just call the 'display()' method on this object to display the menu.
1044
 *   This can also be used as a sub-menu of any other menu, simply by
1045
 *   inserting this menu into a parent menu's 'contents' list.  
1046
 */
1047
topInstructionsMenu: MenuItem 'How to Play Interactive Fiction';
1048
1049
/* the chapter menus */
1050
+ MenuLongTopicItem
1051
    isChapterMenu = true
1052
    title = 'Introduction'
1053
    heading = nil
1054
    menuContents =
1055
        "\b<b>Introduction</b>
1056
        \bWelcome!  If you&rsquo;ve never played Interactive Fiction
1057
        before, these instructions are designed to help you
1058
        get started.  If you already know how to play this kind
1059
        of game, you can probably skip the full instructions, but
1060
        you might want to type ABOUT at the command prompt for a
1061
        summary of the special features of this story.
1062
        \b
1063
        To make the instructions easier to navigate, they&rsquo;re
1064
        broken up into chapters.  At the end of each chapter, just press
1065
        <b><<curKeyList[M_SEL][1].toUpper()>></b> to proceed to
1066
        the next chapter, or <b><<curKeyList[M_PREV][1].toUpper()>></b>
1067
        to return to the chapter list. "
1068
;
1069
1070
+ InstructionsMenu 'Entering Commands' ->(&showCommandsChapter);
1071
+ InstructionsMenu 'Command Abbreviations' ->(&showAbbrevChapter);
1072
+ InstructionsMenu 'Travel' ->(&showTravelChapter);
1073
+ InstructionsMenu 'Manipulating Objects' ->(&showObjectsChapter);
1074
+ InstructionsMenu 'Interacting with Other Characters'
1075
    ->(&showConversationChapter);
1076
+ InstructionsMenu 'Time' ->(&showTimeChapter);
1077
+ InstructionsMenu 'Saving and Restoring' ->(&showSaveRestoreChapter);
1078
+ InstructionsMenu 'Other Special Commands' ->(&showSpecialCmdChapter);
1079
+ InstructionsMenu 'Unknown Words' ->(&showUnknownWordsChapter);
1080
+ InstructionsMenu 'Ambiguous Commands' ->(&showAmbiguousCmdChapter);
1081
+ InstructionsMenu 'Advanced Command Formats' ->(&showAdvancedCmdChapter);
1082
+ InstructionsMenu 'A Few Tips' ->(&showTipsChapter);
1083
1084
#endif /* INSTRUCTIONS_MENU */
1085