ÓADVDB/00100 .PW 100 00110 .M2 4 00120 .M3 5 00130 .M4 1 00140 .PL 66 00150 .OV 12 00160 .LM 8 00170 .RM 80 00180 .FC 00190 .FT *** PRIVATE *** *** NO DISTRIBUTION *** 00200 .HC 00210 .HE ADVENTURE Data Base Page # Allan Moluf 00220 .CE 00230 The ADVENTURE Data Base Format 00240 00250 .CE 00260 by Allan Moluf 00270 00280 The ADVENTURE program written by Scott Adams uses a file 00290 or data base which contains the details of the 00300 particular adventure. 00310 This article describes the organization of these data 00320 bases. 00330 The primary use of this information is to create new 00340 adventures; although it possible to examine or edit 00350 existing adventures. 00360 00370 The data base constains the following sections: 00380 00390 .LM +10 00400 .TI -5 00410 1) Header information which specifies how big the 00420 different sections are and some other constants. 00430 .TI -5 00440 2) Action entries which determine how the player input 00450 is handled and what automatic actions happen. 00460 .TI -5 00470 3) Vocabulary entries which are the verbs and nouns 00480 that the player may use in this game. 00490 .TI -5 00500 4) Messages given by the program under control of the 00510 various action entries. 00520 .TI -5 00530 5) Rooms which include the directions to adjacent rooms 00540 and text descriptions. 00550 .TI -5 00560 6) Object descriptions and initial locations; the description has special information identifying treasures and objects 00570 description has special information identifying treasures 00580 and objects that may be carried and dropped. 00590 .TI -5 00600 7) Titles for the action entries, which are ignored by 00610 the ADVENTURE program but may be used when editing the 00620 ADVENTURE. 00630 .TI -5 00640 8) Trailer information containing the version, number 00650 of the adventure and a security checksum. 00660 00670 .LM -10 00680 The header information (1) contains the following numbers: 00690 00700 .LM +10 00710 .TI -5 00720 1) The number of bytes required to contain the text of 00730 the verbs, nouns, messages, room descriptions and object 00740 descriptions. This number includes a fixed number of bytes for 00750 each verb and noun (one more thean the max word length). 00760 It includes one more than the number of characters 00770 between quotes in the messages and room and object 00780 descriptions. It also includes one more byte for each 00790 object than can be carried and dropped. 00800 The number of bytes specified may be larger than is 00810 necessary, but must not be smaller or the ADVENTURE 00820 program will tell how much too small it is and quit. 00830 00840 .TI -5 00850 2) The highest numbered object in this adventure. 00860 Objects are numbered starting at zero, so the number 00870 of objects is one more than this value. 00880 00890 .TI -5 00900 3) The highest numbered action in this adventure. 00910 Actions are numbered starting at zero, so the number 00920 of actions is one more than this value. 00930 00940 .TI -5 00950 4) The highest numbered vocabulary word in this 00960 adventure. 00970 This applies to both verbs and nouns, being the larger 00980 value if they are different. 00990 Vocabulary words are numbered from zero, so the number of 01000 verbs and the number of nouns is one more than this value. 01010 01020 .TI -5 01030 5) The highest numbered room in this adventure. Rooms 01040 are numbered from zero, but room zero is reserved; so the 01050 the total number of rooms is one more than this value. 01060 01070 .TI -5 01080 6) The maximum number of objects which can be carried. 01090 Under certain circumstances, the actions may cause more 01100 than this to be carried (usually bad things like chigger 01110 bites) but the player will not be able to pick up anything 01120 unless the number of objects he is carrying is less than 01130 this value. 01140 01150 .TI -5 01160 7) The starting room for this adventure. 01170 01180 .TI -5 01190 8) The number of treasures in this adventure. The 01200 SCORE command uses this to give a percentage score. 01210 01220 .TI -5 01230 9) The word length used in this adventure. The nouns 01240 and verbs and the words to pick up objects are affected 01250 by this value. This is the minimum number of characters 01260 the player must type in his verbs and nouns. 01270 01280 .TI -5 01290 10) The time limit. This may be used in some games to 01300 control how long the artificial light lasts, or if there 01310 is no articial light it may limit the number of turns in 01320 the game. 01330 If the artificial light is re-filled, this value is put 01340 back in the time limit. 01350 01360 .TI -5 01370 11) The highest numbered message. Since messages are 01380 numbered from zero, the number of messages is one more 01390 than this value. Message 0 is reserved. 01400 01410 .TI -5 01420 12) The treasure room number. When treasures are in 01430 this room, they are considered to be collected and the 01440 score routine counts them. 01450 01460 .LM -10 01470 The action entries (2) contain information on when they 01480 are to be applied and what is to be done then. 01490 Some action entries respond to the player's input and 01500 some control automatic actions. 01510 The action entries consist of eight numbers. The first 01520 determines when the action is considered. The next five 01530 specify conditions necessary or give parameters for the 01540 commands. The last two words specify what primitive 01550 commands are to be performed. 01560 01570 The first number is (150*verb + noun). If the verb is 01580 zero, it represents an automatic action and the noun 01590 (1-100) determines the probability with which it occurs. 01600 If the verb is not zero, it must match the verb in the 01610 player's input and the noun must match the noun in the 01620 player's input for this action to be considered. 01630 (If the noun is zero, it matches any possible noun in 01640 the player's input.) 01650 01660 If the action is considered, the five conditions are 01670 evaluated. If any fail, the action is not performed. 01680 The conditions are (20*number + cond). The possible 01690 condition codes and their meanings are: 01700 01710 .LM +15 01720 .TI -10 01730 0 Par The condition always passes. The number may 01740 be used as a parameter for the commands in this action 01750 entry. See the commands for the uses of parameters. 01760 01770 .TI -10 01780 1 HAS The condition passes is the player is carry 01790 the numbered object. It fails if the numbered object 01800 is in this room or any other room. 01810 01820 .TI -10 01830 2 IN/W The condition passes if the player is in the 01840 room with the numbered object. It fails if the numbered 01850 object is in any other room or is being carried. 01860 01870 .TI -10 01880 3 AVL The condition passes if the player has the 01890 numbered object available either because he is carrying 01900 it or it is in the same room. It fails if the numbered 01910 object is in any other room. 01920 01930 .TI -10 01940 4 IN The condition passes if the player is in the 01950 numnbered room. It fails if the player is in any other 01960 room. 01970 01980 .TI -10 01990 5 -IN/W The condition fails if the player is in the 02000 same room as the numbered object. It passes if the player 02010 is carrying the object or the object is in any other room. 02020 02030 .TI -10 02040 6 -HAVE The condition fails if the player is carrying 02050 the numbered object. It passes if the object is in the 02060 same room as the player or any other room. 02070 02080 .TI -10 02090 7 -IN The condition fails if the player is in the 02100 numbered room. It passes if the player is in any other 02110 room. 02120 02130 .TI -10 02140 8 BIT The condition passes if the numbered flag-bit 02150 is set. It fails if the flag-bit is cleared. See the 02160 description later for flag-bits. 02170 02180 .TI -10 02190 9 -BIT The condition fails if the numbered flag-bit 02200 is set. It passes if the flag-bit is cleared. See the 02210 description later for flag-bits. 02220 02230 .TI -11 02240 10 ANY The condition passes if the player is carrying 02250 any objects at all. It fails if the player is carrying 02260 no objects. 02270 02280 .TI -11 02290 11 -ANY The condition fails if the player is carrying 02300 any objects at all. It passes if the player is carrying 02310 no objects. 02320 02330 .TI -11 02340 12 -AVL The condition fails if the numbered object is 02350 available either because the player is carrying it or it 02360 is in the same room. It passes if the object is in any 02370 other room. 02380 02390 .TI -11 02400 13 -RM0 The condition fails if the numbered object is 02410 in room 0 (the storeroom). It passes if the object is in 02420 any other room. 02430 02440 .TI -11 02450 14 RM0 The condition passes if the numbered object is 02460 in room 0 (the storeroom). It fails if the object is in 02470 any other room. 02480 02490 .TI -11 02500 15 CT<= The condition passes if the counter is less 02510 than or equal to the number. It fails if the counter is 02520 greater than the number. See the description of the 02530 counter later. 02540 02550 .TI -11 02560 16 CT> The condition passes if the counter is greater 02570 than the number. It fails if the counter is less than or 02580 equal to the number. 02590 See the description of the counter later. 02600 02610 .TI -11 02620 17 ORIG The condition passes if the numbered object is 02630 in the room it originally started in. It fails if the 02640 object is being carried or is in any other room. 02650 02660 .TI -11 02670 18 -ORIG The condition fails if the numbered object is 02680 in the room it originally started in. It passes if the 02690 object is being carried or is in any other room. 02700 02710 .TI -11 02720 19 CT= The condition passes if the counter is equal 02730 to the number. It fails if the counter is not equal to 02740 the number. 02750 02760 .LM -15 02770 There are thirty-two possible flag-bits numbered from 0 02780 to 31. They are all initially cleared. There are 02790 commands to set and clear them as well as the conditions 02800 to test their values. 02810 Two of the flags have assigned meanings: 02820 02830 .LM +10 02840 .TI -5 02850 15) Means it is dark out when the flag is set. The 02860 room will be in darkness if the artificial light source 02870 is not in the room or being carried. (Object 9 is the 02880 lighted artificial light source.) 02890 There are two special commands (NIGHT and DAY) to set 02900 and clear this flag-bit. 02910 02920 .TI -5 02930 16) Means the artificial light has run out when it is 02940 set. The FILL command clears this flag-bit when it 02950 resets the time limit to the original maximum. 02960 02970 .LM -10 02980 The counter is special value which can be incremented and 02990 decremented by special commands as well as tested by some 03000 conditions. 03010 There are also alternate counters which can be exchanged 03020 with the counter in order to operate on other numbers. 03030 03040 The value of the current room may be saved and restored 03050 by exchanging the current room register with one of the 03060 alternate room registers. The saved value may be 03070 restored at a later time by another exchange. 03080 03090 The seventh and eighth numbers in an action entry contain 03100 four command codes. The seventh number is (150*CMD1 + 03110 CMD2) and the eighth number is (150*CMD3 + CMD4). 03120 03130 These commands may use one or more parameters found in 03140 the condition numbers for this action entry. 03150 If a command uses one parameter, its value is represented 03160 by Par #1 in the following descriptions. If a command uses 03170 two parameters the first is represented by Par #1 and the 03180 second by Par #2. The parameters used by any command are 03190 skipped by following commands if they also use parameters. 03200 03210 The possible command codes mean the following: 03220 03230 .LM +15 03240 .TI -10 03250 0 No command or message. This command actually 03260 displays message 0 which is null. 03270 03280 .TI -11 03290 1-51 Display message number 1-51. 03300 03310 .TI -11 03320 52 GETx Pick up the Par #1 object unless he already 03330 is carrying the limit. The object may be in this room or 03340 in any other room. 03350 03360 .TI -11 03370 53 DROPx Drop the Par #1 object in the current room. 03380 The object may be carried or may be in another room. 03390 03400 .TI -11 03410 54 GOTOy Move the player to the Par #1 room. This command 03420 should be followed by a DspRM command. Also, this may 03430 need to be followed by a DAY/NIGHT command. 03440 03450 .TI -11 03460 55 x->RM0 Move the Par #1 object to room 0 (the storeroom). 03470 03480 .TI -11 03490 56 NIGHT Set the darkness flag-bit (15). It will be 03500 dark if the artificial light source is not available, so 03510 this should be followed by a DspRM command. 03520 03530 .TI -11 03540 57 DAY Clear the darknes flag-bit (15). This should 03550 be follwed by a DspRM command. 03560 03570 .TI -11 03580 58 SETz Set the Par #1 flag-bit. 03590 03600 .TI -11 03610 59 x->RM0 This command also moves the Par #1 object to room 03620 0 (the storeroom), like command 55. 03630 03640 .TI -11 03650 60 CLRz This clears the Par #1 flag-bit. 03660 03670 .TI -11 03680 61 DEAD Tell the player he is dead, goto the last room 03690 (usually some form of limbo), make it DAY and display the 03700 room. 03710 03720 .TI -11 03730 62 x->y Move the Par #1 object to the Par #2 room. This will 03740 automatically display the room if the object came from 03750 or went to the current room. 03760 03770 .TI -11 03780 63 FINI Tell the player the game is over and ask if he 03790 wants to play again. 03800 03810 .TI -11 03820 64 DspRM Display the current room. This checks if the 03830 darknes flag-bit (15) is set and the artificial light 03840 (object 9) is not available. If there is light, it 03850 displays the room description, the objects in the room 03860 and any obvious exits. 03870 03880 .TI -11 03890 65 SCORE Tells the player how many treasures he has 03900 collected by getting them to the treasure room and what 03910 his percentage of the total is. 03920 03930 .TI -11 03940 66 INV Tells the player what objects he is carrying. 03950 03960 .TI -11 03970 67 SET0 Sets the flag-bit numbered 0. (This may be 03980 convenient because no parameter is used.) 03990 04000 .TI -11 04010 68 CLR0 Clears the flag-bit numbered 0. (This may be 04020 convenient because no parameter is used.) 04030 04040 .TI -11 04050 69 FILL Re-fill the artificial light source and clear 04060 flag-bit 16 which indicates that it was empty. This 04070 also picks up the artificial light source (object 9). 04080 This command should be followed by a x->RM0 to store the 04090 unlighted light source. (These are two different objects.) 04100 04110 .TI -11 04120 70 CLS This command cleared the screen on the BASIC 04130 version of ADVENTURE. It does nothing in the machine 04140 language version. 04150 04160 .TI -11 04170 71 SAVE This command saves the game to tape or disk, 04180 depending on which version is used. It writes some 04190 user variables such as time limit and the current room 04200 and the current locations of all objects out as a saved 04210 game. 04220 04230 .TI -11 04240 72 EXx,x This command exchanges the room locations of 04250 the Par #1 object and the Par #2 object. If the objects in the 04260 current room change, the new description will be 04270 displayed. 04280 04290 .TI -11 04300 73 CONT This command sets a flag to allow more than 04310 four commands to be executed. When all the commands in 04320 this action entry have been performed, the commands in 04330 the next action entry will also be executed if the verb 04340 and noun are both zero. The condition fields of the new 04350 action entry will contain the parameters for the commands 04360 in the new action entry. When an action entry with a 04370 non-zero verb or noun is encountered, the continue flag 04380 is cleared. 04390 04400 .TI -11 04410 74 AGETx Always pick up the Par #1 object, even if that 04420 would cause the carry limit to be exceeded. Otherwise, 04430 this is like command 52, GETx. 04440 04450 .TI -11 04460 75 BYx<-x Put the Par #2 object in the same place as the 04470 Par #1 object. If the Par #2 object is being carried, this 04480 will pick up the Par #1 object too, regardless of the carry 04490 limit. If this changes the objects in the current room, 04500 the room will be displayed again. 04510 04520 .TI -11 04530 76 DspRM This displays the current room, just like 04540 command 64. 04550 04560 .TI -11 04570 77 CT-1 This subtracts 1 from the counter value. 04580 04590 .TI -11 04600 78 DspCT This displays the current value of the 04610 counter. 04620 04630 .TI -11 04640 79 CT<-n This sets the counter to the Par #1 value. 04650 04660 .TI -11 04670 80 EXRM0 This exchanges the values of the current room 04680 register with the alternate room register 0. This may 04690 be used to save the room a player came from in order to 04700 put him back there later. This should be followed by a 04710 GOTOy command if the alternate room register 0 had not 04720 already been set. 04730 04740 .TI -11 04750 81 EXm,CT This command exchanges the values of the 04760 counter and the Par #1 alternate counter. There are eight 04770 alternate counters numbered from 0 to 7. Also, the time 04780 limit may be accessed as alternate counter 8. 04790 04800 .TI -11 04810 82 CT+n This adds the Par #1 value to the counter. 04820 04830 .TI -11 04840 83 CT-n This subtracts the Par #1 value from the counter. 04850 04860 .TI -11 04870 84 SAYw This says the noun (second word) input by the 04880 player. 04890 04900 .TI -11 04910 85 SAYwCR This says the noun (second word) input by the 04920 player and starts a new line. 04930 04940 .TI -11 04950 86 SAYCR This just starts a new line on the display. 04960 04970 .TI -11 04980 87 EXc,CT This exchanges the values of the current room 04990 register with the Par #1 alternate room register. This may 05000 be used to remember more than one room. There are six 05010 alternate room registers numbered from 0 to 5. 05020 05030 .TI -11 05040 88 DELAY This command delays about 1 second before 05050 going on to the next command. 05060 05070 .TI -11 05080 89-101 These commands are undefined in version 8.2 05090 of ADVENTURE and should not be used. 05100 05110 .TI -12 05120 102-149 Display messages 52-99. 05130 05140 .LM -15 05150 Each vocabulary entry (3) consists of a verb string and 05160 a noun string. Synonyms are handled by words beginning 05170 with an asterisk, which are treated the same as the 05180 previous verb or noun without an asterisk. Some of the 05190 vocabulary entries are predefined for the ADVENTURE 05200 program: 05210 05220 .LM +15 05230 .TI -10 05240 Verbs 05250 .TI -10 05260 0 AUTO This is not entered by the player. It denotes 05270 the action entries which are automatic after a player 05280 action. 05290 .TI -10 05300 1 GO This is a special case for the direction nouns 05310 1-6. 05320 .TI -11 05330 10 CARRY This is used to pick up objects if there is 05340 no action entry that applies and the noun matches the 05350 name enclosed in slashes in an object in this room. 05360 .TI -11 05370 18 DROP This is used to drop objects if there is no 05380 action entry that applies and the noun matches the name 05390 enclosed in slashes in an object being carried. 05400 05410 .TI -10 05420 Nouns 05430 .TI -10 05440 0 ANY This is not entered by the player. It denotes 05450 the action entries which can match any noun (or no noun). 05460 .TI -10 05470 1 NORTH This is reserved for the first room direction 05480 entry with verb 1. 05490 .TI -10 05500 2 SOUTH This is reserved for the second room direction 05510 entry with verb 1. 05520 .TI -10 05530 3 EAST This is reseved for the third room direction 05540 entry with verb 1. 05550 .TI -10 05560 4 WEST This is reserved for the fourth room direction 05570 entry with verb 1. 05580 .TI -10 05590 5 UP This is reserved for the fifth room direction 05600 entry with verb 1. 05610 .TI -10 05620 6 DOWN This is reserved for the sixth room direction 05630 entry with verb 1. 05640 05650 .LM -15 05660 05670 The room entries (4) consist of the number of the 05680 adjacent rooms in the six reserved directions N, S, E, W, 05690 U and D plus a room description string. If the adjacent 05700 room number is zero, there is "no obvious exit" in that 05710 direction. If a description does not begin with an 05720 asterisk, the ADVENTURE program with preface the display 05730 of the room with "You're in a "; otherwise, it will just 05740 display the description, omitting the asterisk. 05750 05760 Room 0 is normally reserved as a storeroom for objects 05770 which are not to be in any of the other rooms. The player 05780 can not get to room 0 by GOing in any direction, and 05790 the actions will usually not let him get there either. 05800 05810 The last room is reserved for a sort of limbo where the 05820 player is sent by the DEAD command. It may or may not 05830 have exits back to the other rooms. 05840 05850 The messages (5) consist of a single string for each 05860 possible message to be displayed by any of the action 05870 entries. Entry 0 is special, being used for no other 05880 action, so it should be an empty string "". 05890 05900 The object entries (6) consist of a string describing 05910 the object and the number of the room in which the 05920 object starts. Room 0 is the storeroom for objects 05930 which are not to be found yet. Minus 1 is used for 05940 objects which the player is carrying. 05950 05960 The object description should begin with an asterisk if 05970 the object is to be recognized as a treasure; treasures 05980 have asterisks around the description. 05990 Also, if the object is to be picked up or put down, the 06000 word to use for it is enclosed in slashes at the end of 06010 the description. If the verb is 10 (CARRY) or 18 (DROP) 06020 and no other action applies, the ADVENTURE program will 06030 automatically pick up or drop the object if the name 06040 matches the noun in the player's input. (The name does 06050 not have to be a noun in the vocabulary for this pick up 06060 or drop to work.) 06070 06080 An example of a treasure that can be picked up is: 06090 06100 .TI +5 06110 "*FIRESTONE* (cold now)/FIR/" 06120 06130 which can be picked up by the word "FIR". Before the 06140 firestone cools, this object was in the storeroom and a 06150 different object was in the room: 06160 06170 .TI +5 06180 "glowing *FIRESTONE*" 06190 06200 Because it does not begin with an asterisk, it is not 06210 recognized as a treasure if it is in the treasure room, 06220 and it cannot be picked up because it has no name. 06230 The action that cools the firestone swaps the locations 06240 of these two similar objects. 06250 06260 The object number 9 should be the artificial light source 06270 in its lighted state. The ADVENTURE program checks to 06280 see if object 9 is in the room or being carried when the 06290 room is in darkness (NIGHT). 06300 Also, the FILL command GETs object 9 when the light is 06310 recharged. 06320 06330 The action titles (7) in the data base are labels for the 06340 actions which serve as reminders of what this action does 06350 to simplify the adventure writer's writing. Each title 06360 is a string. The ADVENTURE program discards the titles, 06370 because they are only used by the ADVENTURE EDITOR 06380 program. 06390 06400 The trailer information (8) contains the version, the 06410 adventure number and the security checksum. The version 06420 number 415 will be displayed as "4.15". The adventure 06430 number is simply a number identifying the adventure. 06440 The security checksum is (2*#actions + #objects + version). 06450 If this is not correct, the ADVENTURE program will not 06460 allow the use of this data base. 06470 06480 When ADVENTURE is interpreting the player's input, it 06490 ignores the AUTO action entries and searches for the 06500 first action entry which has a matching verb and noun 06510 and no failing conditions. After performing the commands 06520 in that entry, it goes to the AUTO actions and then gets 06530 more player input. If no actions match, it checks to see 06540 if the verb is CARRY or DROP with an appropriate object 06550 name. 06560 06570 .ET ions. After performing the commands 06520 in that entry, it goes to the AUTO actions and then gets 06530 more player input. If no actions match, it checks to see 06540 if the verb is CARRY or DROP with an appropriate object 06