############################################################################# # Ruins -- an IFM example map based on the Inform example game. This game # originally existed only in snippets throughout Graham Nelson's Inform # Designer's Manual until Roger Firth produced a playable version of it. # It serves as a good demo of IFM capabilities, since it doesn't give away # any secrets from a 'real' game. The source for Ruins is available from # all good IF archives. ############################################################################# # First, set the title for the map, which gets printed out (for example) at # the top of each PostScript output page. title "Ruins"; # Set the title of the first map section. In this example there is only # one map section, so it's not strictly necessary, but we'll put one in # anyhow. map "Mayan Temple"; ############################################################################# # Declare the room that we start the game in. room "Dark Forest"; # The first thing we see is the mushroom. Give it a tag, so we can refer # to it later. item "speckled mushroom" tag mushroom; # On picking the mushroom, we notice a statuette in the grass. It can't # be taken until the mushroom is, so give it a 'need' clause. It's also # not immediately apparent in the room, so mark it hidden. item "statuette" tag statue hidden need mushroom; # After a while, a plane turns up and drops the packing case. Let's wait # for it to arrive. The actual command typed to do that is WAIT, several # times. Note that doing this is optional -- you only need to use tasks # if you want to record what you did, as well as where you've been. task "Wait for aeroplane" cmd "wait" 3; # For completeness, let's add the packing case too, but it doesn't really # play a part in the solution. item "packing case" hidden; # The game is won by putting all the treasures in the packing case, which # happens to be in the start room in this game. So the game-winning # tasks also appear here. As done here, stashing each treasure is a # separate task, but you could also implement it as a single task which # requires all four treasures. The only difference would be possibly # different behaviour from the game solver. task "Put statuette in case" tag pack_statue need statue lose it score 10; task "Put bangle in case" tag pack_bangle need bangle lose it score 20; task "Put ruby in case" tag pack_ruby need ruby lose it score 30; task "Put wax in case" tag pack_wax need wax lose it score 40; # After all the treasures are stashed, the game is over. task "Wait for helicopter" after pack_statue pack_bangle pack_ruby pack_wax cmd "wait" 2 finish; # Going down, we get to the square chamber. Let's put this room below the # start room (south, that is), but indicating that the direction is # actually down. The room description indicates that there are two other # exits -- south and east. Add those too. room "Square Chamber" tag Chamber dir s go down exit s e; # Add the decorations. item "carvings"; # Obviously (?) the thing to do here is to put the mushroom in the sunlight. # This eventually leads us to the special carvings on the wall. task "Put mushroom in sunlight" need mushroom lose it; task "Examine trails" after last; task "Examine carvings" after last; # When we press the carvings, a panel opens containing the iron key. task "Press carvings" after last; item "iron key" tag key hidden after last; # Going south, we enter a mossy corridor... room "Stooped Corridor" dir s; # As usual, the visible decorations. item "moss"; # Examining the moss, and searching it, we find a ruby. task "Examine moss"; task "Search moss" after last; item "blood-red ruby" tag ruby hidden after last; # We need the iron key to open the door. task "Unlock door with key" need key; task "Open door" after last tag open_door; # Passing through the door, we enter the shrine. But the door must have been # opened first. room "Lofty Shrine" dir s after open_door; # The visible items. item "stone slab"; item "mummified priest"; # We can interact with the mummy in many ways, but the important # game-solving task is to return the iron key, for which we're # rewarded. task "Put key on slab" need key lose it give wax; item "wax" tag wax hidden; # The shrine is a dead end, but we can also go east from the Square # Chamber. Doing that plunges us into the Web of Darkness. Illustrate # that it's dark by using a new display style. Note that the 'style' # clause must come before the 'dir' clause, or it will apply to the # implicit link and not the room. room "Web of Darkness" style Dark dir e from Chamber oneway; item "scuttling claws"; # Going southeast takes us to the second web room. Make that dark too. room "Web of Darkness" style Dark dir se oneway; item "scuttling claws"; # This second room returns to the Square Chamber by going northeast, # requiring a convoluted link. link last to Chamber dir ne n w 2 oneway; # The act of going northeast gives you a bangle (you trip over it and # pick it up). There are two ways of doing this: with an explicit # movement task that puts you back in the Square Chamber, or a 'dummy' # task that hands you the bangle in this room without you doing # anything. Let's use the first method. item "silver bangle" hidden tag bangle; task "Stumble over bangle" give bangle cmd "NE" goto Chamber tag find_bangle; # The other alternative would be: # task "Stumble over bangle" give bangle cmd none; ############################################################################# # That's it for the map. The only thing remaining to do is to define the # display style we've used for the dark rooms. Let's just set the room # background colour to be darker. Note that you could also define the # "Dark" style by putting it in a file called "Dark.ifm", and then putting # that file in a directory which is searched by IFM. That way, many maps # could use the same style definition. room_colour = "gray70" in style Dark; #############################################################################