Skip to reading
Text & Sierra-Style Adventures

42. Add containers, pronouns and more rooms carefully

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

Once the little game works, you can extend it. Keep each new grammar feature explicit so a sentence cannot accidentally trigger a different puzzle.

Source table from 42. Add containers, pronouns and more rooms carefully, page 45
FeatureState and parsing you need
LOOK IN BOXA container-open flag, contents list and a grammar branch that preserves IN.
PUT FUSE IN BOXA two-object rule with IN; checks for carried source and accessible container.
USE IT ON DOORA saved or session last-noun value; a rule to resolve IT before validating ownership.
Which key?A candidate list, a pending question and a way to accept the answer as the next input.
More roomsAn exit map with explicit destination/spawn and optional conditions.
Several commands in one lineA queue and a rule that stops processing when a reply, room change or failure requires attention.

Do not reuse the ignored-word list to erase IN and then try to infer a container action afterward. Preserve meaningful separators until the grammar has used them.

The example handles one command at a time. It rejects or fails to match extra phrases instead of promising general natural-language understanding. Keep that limit in the game’s HELP text so players know how to talk to it.

Page 45 of 68Permalink
Go to page