(This is the "Dungeon Designs" column from the June 1992 issue of the Eamon Adventurer's Guild newsletter. Copyright 1992 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.) The Synonym Checker by Tom Zuchowski One feature of modern Eamon adventures is the ability to "embed" artifacts in room descriptions. Such embedded artifacts do not appear in the room until the player examines them, at which time they are converted from embedded to normal. The biggest drawback of embedded artifacts is that the artifacts name must correspond almost exactly with the name used in the room description. This is often difficult to accomplish in a way that reads well. For example, if there is a secret hidden trapdoor in the floor, the room description can hardly say so! This difficulty could be gotten around in older Eamon version by making the trapdoor a "hidden" artifact that would appear in the room when the player did a LOOK command, but version 7.0 does not support hidden artifacts. The solution for this problem in version 7.0 was the implementation of the SYNONYMS routine at line 4600. This routine is designed specifically to identify embedded artifacts that may have names that are drastically different from the one in the room description. Let's look at an example of a synonym and how it is handled by the routine. We'll use that hidden trapdoor that I mentioned before, and let's say that it is Artifact #17 and is located in Room #21, and its name is SECRET TRAPDOOR. First, the room description: THIS ROOM IS LONG AND NARROW, WITH A HIGH CEILING. THE WALLS ARE LINED WITH MOUNTED ANIMAL HEADS. THERE IS AN ORNATE RUG CENTERED ON THE FLOOR. THERE IS A BUMP IN THE RUG NEAR ONE CORNER. Now, let's generate the lines for the Synonym Checker: 4610 SL = LEN (S$) 4620 IF RO = 21 THEN SY$ = "RUG": SY = 17: GOSUB 4680 4630 IF RO = 21 THEN SY$ = "BUMP": SY = 17: GOSUB 4680 4675 RETURN 4680 IF LEFT$ (SY$,SL) = S$ OR RIGHT$ (SY$,SL) = S$ THEN S$ = A$(SY): POP 4690 RETURN Variables: S$ is the "object" that the player is examining SL is the length of the object name that the player typed RO is the Room that the player is in SY$ is a synonym for the object SY is the artifact number tied to the synonym My example sets up two possible synonyms for the secret trapdoor: RUG and BUMP. Let's examine the routine on a line-by-line basis: 4610 finds the length of the object name the player typed in. 4620 checks to see if the player is in room 17. If he is, it passes the synonym name RUG and the artifact number of the secret door (which is artifact #17) to the compare subroutine at 4680. 4630 is the same as line 4620 but for the synonym BUMP. 4675 exits the synonym routine if no synonym match was found. 4680 compares the synonym SY$ to the object S$. If a match is found, it changes the object name to the name of the synonym and POPs the subroutine stack to avoid returning to the synonym checker. 4690 exits the compare subroutine. If no match was found, it RETURNs to the synonym checker in case there are multiple synonyms in the room. If a match was found, it RETURNs to the routine that called the synonym checker. In my example, there are two possible synonyms in the room, RUG and BUMP. The command EXAMINE RUG would execute these lines: 4610, 4620, 4680, 4690. The command EXAMINE BUMP would execute these lines: 4610, 4620, 4680, 4690, 4630, 4680, 4690. As you can see, the number of lines executed goes up rapidly with each synonym that is added. This is why the room number RO is checked in 4620 and 4630; if the player is not in room 17 then the lines executed for either command would be: 4610, 4620, 4630, 4675. This avoids wasting time checking for synonyms that aren't even in the room. Even though my example uses just two synonyms, you can add as many as you want. There is room for 69 synonyms without renumbering the routine, and as many as 94 if you renumber. The synonym checker is a great tool and I strongly recommend that you take advantage of it.