I’m new to Inform 7 and getting the hang of things. I have one large space I’m representing as smaller rooms, but I’m giving those rooms numbers instead of proper names.
What I’d like to do is go through and modify the printed names of rooms 1, 4, 7, 10, and 13 to say something like, “Port side of the engine room”, while doing something similar for 3, 6, 9, 12, and 15, but saying that’s the starboard side.
I could type all these out as room names, but it’s honestly easier in my brain to set up the linkages if the rooms are numbered this way rather than containing names. The idea is that the numbers are distinct and won’t collide, but also, I can sort of not give the player an exact notion of where they are.
What’s wrong with an approach where you keep the numbers as the internal names of the room, but change the printed names?
Room 3 is west of room 4. The printed name of room 3 is “Port side of engine room”.
An alternative is to group rooms together in regions, then use a rule like
Rule for printing the name of a room:
which checks whether the room is in a particular region and then susbtitutes the name you want for rooms in that region. But if you have just a handful of rooms that this applies to, I think the manual approach should be fine.
A port-room is a kind of room.
The printed name of a port-room is usually "port side of the engine room".
Understand "port", "side", "of", "the", "engine", and "room" as a port-room.
Room-1 is a port-room. Room-4 is a port-room. Room-7 is a port-room.
Room-10 is a port-room. Room-13 is a port-room.
That’s pretty tidy. I was going for an approach where I match on a regular expression, pull out the number and use that to modify the room’s printed name, but I was having problems with it. I also tend to over-complicate things
Since Inform can work out room what rooms are adjacent to each-other, you may have an opportunity to automate printed name generation. This would be overkill for a couple of rooms, but if you are using room[number] to designate rooms often, you might find this kind of approach worthwhile.
engineering is a room.
engine_room is a kind of room.
room1 is north of engineering. it is an engine_room.
room2 is south of engineering. it is an engine_room.
room3 is east of engineering. it is an engine_room.
room4 is west of engineering. it is an engine_room.
We can create a definition based on a room’s compass relation to the engine room:
to say engine_room_name for (r - a room):
let way be the best route from engineering to r, using even locked doors;
say "Engineering ([way])";
Using this definition, we can set a default naming scheme for engine_rooms.
the printed name of an engine_room is usually "[engine_room_name for the item described]".
item described is just what it sounds like: the room currently being named.