9. Maintaining an Inventory

Back in Chapter 5, “Building Objects with Variables,” I mentioned Infocom’s first game, Zork, which was published in 1980. It’s a traditional dungeon crawl, a type of game where the player character navigates a space—usually a series of underground rooms or a cave—in search of treasure. Thwarting the player on this scavenger hunt of riches are various dangers, such as a thief and a troll. Dungeon crawls like Zork are pretty straightforward: Pick up every object that isn’t nailed down, kill the thief (but only after he has opened the egg for you!), and dump all the crystal tridents and chests of jewels you find into the trophy case. Every time you deposit a treasure in the trophy case, your score increases. When you ...

Get Writing Interactive Fiction with Twine now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.