Tuesday, April 15, 2014

Dev Log: Horror Text Adventure #46

I shrank the draw and erase commands by a fair bit by finally making the general findItem function.  It basically just looks through an item vector (the player's inventory, or the room's), and compares the name of the item with a pre-defined string.  That is sure to come in immensely useful in many other commands later.

Next, after seeing a Dwarf Fortress update where I got to see some of the code, I noticed Toady One had plural versions of the names of his plant life, etc., as well as adjective versions.  That struck me as pretty interesting, so I'm wondering now if that's the best way to handle problems with English, like words that don't follow plural rules.  So rather than creating some silly functions that pluralizes things and figures out the exceptions and all that, why not just add a variable to each item with a plural version?  Then as the player looks around the room, it's far easier to say "there are two beds here".  As it is, I've already created an item with an exception (the plural of "chalk" is "chalk", or "piece of chalk" becomes "pieces of chalk").  So I've added a plural variable to every item, and started to make a function that finds out how many instances of each item are in a room.  That's a bit more complicated than it seems at first glance.  I've gone through two iterations to figure out the best way to implement it, but I'm still having some trouble.

No comments:

Post a Comment