Friday, November 22, 2013

Dev Log: Horror Text Adventure #30



Not the most visually stunning game, but a screenshot every once in a while is still nice.

Fixed a bug where the player tried examining something that did not exist and it led to a runtime crash.  This was because when checking the player's inventory for that item, if there was nothing in the player's inventory, the items were simply set to null, so they had no type.  So it was trying to check a type when the variable did not even exist.  Easy fix, but error checking sure makes code longer.

Speaking of examining, the player can now type "look at <item>" and "look <item>" in addition to "examine <item>".  Bonus side effect: dictionary function now looks cleaner because huge examine code is moved to a new function.  Similarly, the player can say "take <item>" and "pick up <item>".

The player can also type slightly shortened commands for movement, so instead of "go west", they can also type "go w".  I know that old text adventures had very simple commands like just "w" to go west, but just for the moment I don't want it to be so simple, because I wouldn't want a player to accidentally move to a new room when they are trying to do something else.  So the player has a variety of ways to move, by saying "go", "head", or "move" as the first word, and then a direction or abbreviation of the direction as a second word, so four characters is, I think, short enough for now.  I think it's tough enough to come up with all possible English variations without getting into abbreviations.  Yay language.

The player can now "chat".  That is, if they type "/c" and then a message, their message appears in the chatbox.  Of course, this is not exactly hooked up to the internet yet, so chatting simply displays in your own chatbox and doesn't go out to the world.  But the code that's in place will be replaced (or perhaps added to) once I start with the multiplayer (which will come much later).

I improved player system messages relating to input, by saying exactly what the dictionary didn't understand.  So if you type "go wesr" (misspelling "west") it will tell you it didn't understand "wesr" rather than giving a generic "I don't understand this" message.  One bug about this, however, is a conflict between number of words in the command and the keywords.  So you can say "pick up blah" and you'll get "I don't understand 'blah'," which is what I want, but if you say "pick blah" you'll get "I don't understand 'pick'," which makes no sense.  I'm pretty sure I'll need to overhaul the way the dictionary works at some point.

Also fixed room descriptions so now items in the room are broadly defined ("There is a bed here.") upon entering the room, and longer descriptions ("The pillowcase has bloodstains.") are reserved for examining the item.  (That's how I discovered the bug in the first paragraph above).

Also threw in a couple more description sentences to test.  Now the player may get a varying number of description sentences.  Works ok for now, but still needs cleanup (and probably a cleaner way of making them altogether).

Lastly, you can quit by typing "/quit" instead of just clicking the X in the corner.  Still example commands to create, but five down, three to go is a nice place to be.

I like productive days.

No comments:

Post a Comment