Skip to reading
Text & Sierra-Style Adventures

40. Add a new noun without guessing

Edition 0.86.3.4

Build a complete text or graphical parser adventure with typed commands, inventory puzzles and press-to-walk controls.

Download PDFView PDF page

Suppose you add a bell to the yard. First decide what the player can learn or change. “A bell is here” is not a rule. “Ringing the bell calls the operator” is a rule.

1. Create the bell room object. Give it a stable ID and a readable name.

2. Add bell and signal bell to the native record’s synonyms.

3. In Appendix A’s NOUNS table, map those phrases to bell.

4. Extend present() so bell is present in the yard.

5. Add a Look description and a response for the action you want.

6. If the action changes the story, add a saved variable and test both its before and after states.

Code example
"bell":"bell", "signal bell":"bell"

That line belongs inside the existing NOUNS dictionary, with the correct comma between entries. It is not a complete script. Add one noun at a time and test it with a sensible command, a repeated command and a command from the wrong room.

With the controller active, editing only the native Synonyms field is not enough. The controller uses its own NOUNS and VERBS tables. The native parser and the controller have separate vocabulary sources by design.

Page 43 of 68Permalink
Go to page