Decorate Your IF Rooms

Add objects to your barren Inform adventure rooms.

Thanks to [Hack #85] , we have two rooms, but they’re both empty. Let’s create our first inhabitant: that fierce-eyed access controller in the Router.

Add this object to your source file. You can put it anywhere between the Include "VerbLib"; and Include "Grammar"; lines, but it’s tidier to put it right after the Router object definition.

Object controller "access controller" Router,
  with
    name 'access' 'controller',
    article "an",
    description
        "The controller guards its network connection with
        fierce and watchful intent.",
  has scenery;

This is the controller object. It’s similar to the Router and Scanner objects, but with a couple of differences.

The first line defines an Object called controller, printed in the game as access controller, but there’s a fourth element, Router, that indicates where the object is. It’s not a free-floating thing, as the rooms are. It begins the game inside the Router (in fact, it never moves from there).

The has line, once again, introduces a list of attributes. It’s down at the bottom this time. (That’s a matter of taste; you can put the has attributes before or after the with property declarations.) The only attribute here is scenery. This fixes the controller in place; the player can’t pick it up or move it. Scenery objects must also be mentioned in the room’s description property. The standard library won’t mention it. The controller does appear in the Router’s description, so this ...

Get Gaming Hacks 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.