scrom / Experiments

a NodeJS text adventure - deliberately coded badly to re-experience the pain of legacy code
http://mvta.herokuapp.com/
2 stars 0 forks source link

examine/read need to be slightly more intelligent. #391

Closed scrom closed 8 years ago

scrom commented 8 years ago

Initially I thought "examine" / "read" should try location before player for object. This may be very far-reaching (this is handled by getObjectFromPlayerOrLocation)

Possibly more sensible would be to determine what object the players last action was against. If the next action is against an object with the same name, it should use the same (if available).

This is currently a problem where if a player is carrying a "book" and a location also has a book. Saying "examine" or "read" book - when walking into location will describe the one in the player inventory.

It might be as simple as adding an optional "precedence" parameter to getObjectFromPlayerOrLocation that chooses which to try first

scrom commented 8 years ago

In both these cases I've gone for the simplest common option - if there's one in the player inventory and one at the location, it'll ask the player to be more specific.

scrom commented 8 years ago

fixed & tested

scrom commented 8 years ago

Minor improvement. If one of the items is in a container, player can now specify the cotainer