Friday, January 9, 2015

Latchkey #63 - Take & Drop Commands

I fixed the take command (in a haphazard way, as I do everything) so the player can't pick up an item they've already picked up, so now there's no more duplicated items.

Next, I recoded the drop command, so the player can now drop items again.  Fortunately, that went off without a hitch (well, without many hitches).

I then discovered two more bugs in the take command when testing. First, if the player tries to take an item that's untakeable, he gets the proper message first ("It's too big or heavy"), followed by the wrong message ("Your hands are full").  This is due to some reworking of the take command which eliminated an extra if statement I no longer needed... or so I thought.  The bigger bug (which I think comes from the same removed if statement) is a crash when you try to take anything that isn't there, including items not in the room, non-items ("take gobbledegook"), or nothing at all ("take").  But I think what I actually need to do is stop that stuff from happening before it even gets to the take verb, and instead blocks these from happening while in the main parser.

Perhaps, instead, I need to break down the rather large parser function into smaller bits, called upon by the verb functions themselves.  That way there isn't much wasted time when parsing.  For instance, there's no need to check for items if the player is just walking to the next room.  That will take some time to recode, while I'm in the middle of recoding all the verbs.

I wouldn't want to be me right now.

No comments:

Post a Comment