(This is the "Dungeon Designs" column from the December 1989 issue of the Eamon Adventurer's Guild newsletter. Copyright 1989 Eamon Adventurer's Guild, 7625 Hawkhaven Dr., Clemmons, NC 27012-9408. You may reproduce this freely as long as this credit remains attached to the article.) Basic Eamon Routines (from the 'Eamonomicon' by Hokas Tokas) translation by Nathan Segerlind New Eamon authors have been almost eternally plagued by problems: "How do I add a new command?" "How can I make the POWER spell do what I want?" "How do I..." and the list goes on. In the recently rediscovered 'Eamonomicon', the answers to these and monay more questions were found. If you're new to Eamon designing, read on... IMPORTANT POINTS First, it must be said that it is VERY important to obtain a printout of the MAIN PGM. Without this, it is difficult to decipher the inner workings of each routine. Use the full 80 columns of your printer or even a compressed 132-column mode if you have it, both to save paper and to minimize the paper shuffling while jumping back and forth from routine to routine. Don't fool yourself into the false economy of saving paper; the ease of working on paper, being able to spread it out before you and make notes on the printout will more than make up for 2 cents worth of paper and ribbon. Commit the following variables to memory: RO room player is in M%(x,5) room monster is in A%(x,4) room artifact is in T(1) true is hostile monster is in room M%(0,13) player's wounds (damage or 'hit' points) M%(0,2) player's agility M%(0,3) player's charisma HOW TO ADD A COMMAND To add a command to the MAIN PGM, change these lines: LINE 31910: the number stored in this data statement is the total number of commands. Add 1 to this number for each additional command LINE 31930: put new commands in a list on this line in the same format as line 31920. All commands must be single words with no spaces in the middle; use a hyphen to join two words together if it is a two-word command. LINE 290: add the line numbers where the start of each new command is located. These must be in the same sequential order as the commands at 31920-31930 Add special programming for each new command at the new line numbers specified in line 290 The best thing to do is to look and see how any normal command is handled by the lines listed above. Here are a few tips: End each routine with a GOTO 98. This will print a blank line, update the line counter, and proceed to the code that checks to see if there is a fight in progress. Except in special cases, this should always be the exit point. If the command requires an object, always GOSUB 4900 to check to see if an object was included in the command. If no object was specified, this routine will ask for one before returning. Use the search routines. GOSUB 4700 for monsters and GOSUB 480x for artifacts. If either of these routines return with the variable F = 0, then instead of exiting to 98, exit to the appropriate error message at lines 91-96. Note that the routine at 4800 has different entry points for different circumstances; once again it is best to examine the code in the MAIN PGM to see how it is done. For example, if the artifact you are looking for must be carried by the player for the command to work, see lines 5010-5030 of the DROP command for the proper coding. If the artifact must be in the room, see lines 4010-4020 of the GET command. If the artifact can be carried by the player or be in the room, see lines 6010-6020 of the EXAMINE command. For artifacts that must be worn, see 27010 of the REMOVE command. If the command only works with one particular artifact, DO NOT do a string compare with the artifact's name; instead use this line: IF A < > (# of artifact) THEN 94 If the search routine at 4800 finds a match, it returns with the variable A set to the number of the artifact that it found a match to. By checking the artifact number instead of the string, you are letting the search routine worry about abbreviations so you don't have to, and you also get a very consistent response to different abbreviations. HOW TO USE THE POWER SPELL The POWER spell effects are in lines 13015-13080, though 13080 may be easily renumbered to anything as high as 13990 for more code space. For random effects, such as a chance that a cow may fly past, check to see if the random number RL (generated in line 13010) is smaller than the chance (from 1-100) of it happening. If it involves an artifact or a monster entering the room, set the artifact/monster's location to that room. If it's a monster, be sure to then GOSUB 3600 to check its friendliness. Be sure to put the checks of RL in sequential order. The smallest chances must be checked first, with greater chances following in order of probability. In the following example, the dragon is monster #1 and the box is artifact #1: 13015 IF RL < 35 AND M%(1,5) < > RO THEN PRINT: PRINT " A DRAGON MATERIALIZES!": M%(1,5) = RO: GOSUB 3600: GOTO 98 13020 IF RL < 60 AND A%(1,4) = 0 THEN PRINT: PRINT " A BOX APPEARS!": A%(1,4) = RO: GOTO 98 Also, you can have room-specific effects. These are placed before the random ones and check the room number before being executed. In this example, room 13 has a brick wall, artifact #4, that hides a treasure, artifact #5: 13012 IF RO = 13 AND A%(4,4) = RO THEN PRINT: PRINT "THE WALL EXPLODES! SOMETHING WAS BEHIND IT!": A%(5,4) = RO: GOTO 98 HOW TO USE THE 'USE' COMMAND The USE command is exceptionally easy to use, as all you have to do is check for the artifact you wish to use and then furnish the effects. In the following example, the artifact must be in the player's inventory to be used: 28020 GOSUB 4900: GOSUB 4801: IF NOT F THEN 91 If it can also be in the room, change the above code to read like this: 28020 GOSUB 4900: GOSUB 4804: IF NOT F THEN 94 Here are some examples of code for the USE command (artifact #5 = drugs; #6 = computer; #7 = concrete; #8 = broken wall in room 27; #9 = new wall): 28030 IF A = 5 THEN PRINT: PRINT "WHAT ARE YOU, A FOOL?": GOTO 98 28040 IF A = 6 THEN PRINT: PRINT "THE BLASTED THING EMITS A CURL OF SMOKE, THEN EXPLODES!": A%(6,4) = 0: GOTO 98 28050 IF A = 7 THEN IF RO = 27 THEN PRINT: PRINT "YOU'VE FIXED THE WALL!": A%(7,4) =0: A%(8,4) = 0: A%(9,4) = RO: GOTO 98 You may also have the USE command refer to other commands, if the artifact type is right. This is useful for weapons and healing potions. You must check the artifact type, A%(A,2), to see if its the right type. In this example, the command USE (weapon) will jump to the READY command (artifact type 2 = weapon): 28060 IF A%(A,2) = 2 then 17000 Happy Adventurer slaying!