Friday, June 26, 2015

automatic door unlocking/opening

So, in posting that "Vault of Hugo" transcript the other day, I was reminded my dissatisfaction over the messaging in my first attempt at automatic door unlocking.  Here's the applicable part again:


>dig ground
You find a rusty iron key!
(Taken.)

>e
(unlocking the vault door first)
(with the rusty iron key)
Unlocked.
(opening the vault door first)
Opened.
It's pitch black in here. Stumbling around in the dark isn't such a hot idea: you're liable to be eaten by a grue.

>

Now, the automatic-door-unlocking was one of the first things ever added to Roodylib so, of course, I've learned a lot since then and I thought it was worth taking another swing at it.  Here is a transcript of what would happen now:

>dig ground
You find a rusty iron key!
(Taken.)

>e
(unlocking the vault door with the rusty iron key first)
Unlocked.

(and then opening it)
Opened.

It's pitch black in here. Stumbling around in the dark isn't such a hot idea: you're liable to be eaten by a grue.

>
As you can see, it now combines information where it can, and I added some spacing to make it prettier.  The "(and then opening it)" message was especially tricky to do, but I think the code I threw together should work well enough (it relies on checking the parser_data[PARSER_STATUS] value, and I don't see that changing anytime soon).

I also threw in an option where, if the key object is set quiet, a regular >UNLOCK DOOR asks the player to be more specific or in something like the instance above, does:

>dig ground
You find a rusty iron key!
(Taken.)

>e
The vault door is locked.

>unlock door with key
Unlocked.

>lock door
(with the rusty iron key)
Locked.

>e
(unlocking the vault door with the rusty iron key first)
Unlocked.

(and then opening it)
Opened.

It's pitch black in here. Stumbling around in the dark isn't such a hot idea: you're liable to be eaten by a grue.

>

 I figure there might be instances where you want the player to figure out which key is correct.  After being used correctly once, it'll do automatic unlocking/locking no problem from then on.

Anyhow, I wanted to put the feature there, but I doubt many people will use it so I won't even go to the trouble of aliasing quiet to another more-apt attribute name to be used in these instances.

No comments:

Post a Comment