[I7] Naming and semantics

Let’s say you’re designing a three-story building in your game, and for whatever reason you want the stairs to be actual existing, open doors.

How would you name them? If I am on the third floor and I have “third floor stairs” leading down then I go to the second floor, I still have “third floor stairs” and then there’s the staircase leading down to the first floor. Are those the first floor stairs? Does that mean there isn’t second floor stairs? Or would the “second floor stairs” be the ones leading down from the third floor?

Or, should I write some convoluted code renaming the stairs depending on what floor the player is on?

It’s relatively common to call doors differently depending on which side the player is. The Recipe Book’s chapter on doors has a lot of examples.

Eh, that wasn’t exactly what I was looking for, especially since it’s redundant since I have an Exit Lister extension installed. I was actually looking for a printed name solution. I ended up writing a convoluted code that renames my doors depending on what room the player is in, ala “stairs leading up” becomes “stairs leading down” and vice versa.

You mean like:

The printed name of stairs is "stairs leading [if the player is upstairs]down[otherwise]up".

You can also generalize if you have multiple stairs (with identical printed names):

The stairs are a kind of door. The printed name of stairs is usually "stairs leading [if the direction of the item described from the location is down]down[otherwise]up".

That doesn’t seem too convoluted to me.

If you use “Exit Lister version 2 by Gavin Lambert” you can change the name just for the exit listing with a “For printing the name of a door while listing exits” rule.

Hope this helps.

Uh, yeah, stairs and doors (and chutes & ladders) should likely be named by where they go, rather than by where the player is standing, else the name is effectively useless. (By the same reasoning I dislike compass directions, but that’s neither here nor there… ha-ha.) That’s just good prose and good design, even if it leads to inelegant code.

But surely since doors (and stairs?) are their own Kind of Object, there’s a way to generalize this so the code isn’t too inelegant? Each knows which two locations they connect, so name them all “door/stair to [the other room]”.

I ended up writing a hack because doors can’t be moved, and I needed to treat the stairs as scenery (which they aren’t if they are doors). So in the game the player doesn’t know, but it’s a hack.

Doors can be scenery. You just have to declare them as such. (See example Disenchantment Bay 5.)

But you can’t move doors with code or change their directions, like you can with directions attached to rooms. I wanted to code cutting off a direction, and the exit lister i was using still showed the presence of a door I didn’t want to work anymore.