November 2010
Intermediate to advanced
504 pages
12h 45m
English
Now we’ll tie all of these description functions into one easy command called look. Because this will be the actual command players can enter to look around them in the game, look will need to know a player’s current location. So, we need a variable to track the player’s current position. Let’s call it *location*:
(defparameter *location* 'living-room)
Because the *location* value is initialized to the living-room symbol, which occurs at the very start of the game, players will find themselves in the living room of the wizard’s house. At this point, we can write a look function to describe everything we need by having it call all of our descriptor functions:
(defun look () (append (describe-location *location* *nodes*) (describe-paths ...