I’m trying to allow the player to move around the exits to locations in the game world from a control room. The player will be able to press buttons or something to connect different areas in different ways. This needs to be a little more complicated than an elevator type problem though; think of a 3x3 grid where the player can select a location for any of nine different places and the exits need to work as expected.
I’m not sure how I should go about coding this. Any suggestions?
This is not difficult, provided there are no doors between the locations. Doors in Inform are not movable, unfortunately.
Untested, but I believe if you write code like this:
now the wine cellar is north from the crypt;
…it should do what you have in mind. If you can’t work it out, post another message and I’ll sit down and try to get it working.
How should I organize this mass exit changing though? When the player makes changes in the control room, the exits need to change with respect to other setting in the control room. The changes need to be dynamic.
It’s difficult to give concrete suggestions without knowing what sorts of controls you have, or what functions you want to give them.
I’d just write it one line at a time:
Instead of pulling the red lever:
if the green switch is switched on:
now the wine cellar is north of the crypt;
now the dank pit is east of the crypt;
now the wine cellar is north of the dungeon;
say "Somewhere not far off, you hear an enormous grinding, groaning sound."
There probably aren’t any shortcuts. Just write what you want to happen.
Not sure if you’re trying to make, for example, the exit to the wine cellar sometimes on the north side and sometimes on the south side, which is what others have responded to, I think. In other words, the exit and the room both move.
OR, if you’re trying to just have a bunch of exits on an unmoving map that may or may not be there at a given time. If that’s the case, couldn’t you just program them all in as doors, and then use instead statements to make some of them invisible when they aren’t activated?