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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.