Creating Special Actions in Our Game
We have only one more thing to do now and our game will be complete: Add some special actions that the player has to do to win in the game. The first command will let the player weld the chain to the bucket in the attic:
  (setq chain-welded nil)

  (defun weld (subject object)
    (cond ((and (eq location 'attic)
                (eq subject 'chain)
                (eq object 'bucket)
                (have 'chain)
                (have 'bucket)
                (not chain-welded))
	   (setq chain-welded 't)
           '(the chain is now securely welded to the bucket -))
          (t '(you cannot weld like that -))))
So first we created a new global variable that lets us tell whether we've done this action already. Next, we create a weld function that makes sure all the right conditions are in place for welding and lets us weld.
Welding the chain to the bucket.
<< begin < previous - next > end >>