the-infocom-files / witness

The Witness
3 stars 4 forks source link

Locking and unlocking the clock doesn't check if it already is #39

Open eriktorbjorn opened 4 years ago

eriktorbjorn commented 4 years ago
>UNLOCK CLOCK
The door of the clock is now unlocked.

>UNLOCK CLOCK
The door of the clock is now unlocked.

>LOCK CLOCK
The door of the clock is now locked.

>LOCK CLOCK
The door of the clock is now locked.

Also:

>OPEN CLOCK
As you'd expect, the case holds a long pendulum. You can also see some relays
and things.

>LOCK CLOCK
The door of the clock is now locked.

This is handled by CLOCK-F:

       (<AND <VERB? LOCK> <==? ,PRSO ,CLOCK>>
    <COND (<IN? ,CLOCK-KEY ,WINNER>
           <FSET ,CLOCK ,LOCKED>
           <SETG USED-CLOCK-KEY T>
           <TELL "The door of the clock is now locked." CR>)
          (T <TELL "You don't have the right key." CR>)>
    <RTRUE>)
       (<AND <VERB? UNLOCK> <==? ,PRSO ,CLOCK>>
    <COND (<IN? ,CLOCK-KEY ,WINNER>
           <FCLEAR ,CLOCK ,LOCKED>
           <SETG USED-CLOCK-KEY T>
           <TELL "The door of the clock is now unlocked." CR>)
          (T <TELL "You don't have the right key." CR>)>)

You can also open the clock when it's already open:

       (<AND <VERB? LOOK-INSIDE OPEN SEARCH>
         <NOT <FSET? ,CLOCK ,LOCKED>>>
    <COND (<AND <VERB? LOOK-INSIDE SEARCH> <NOT <FSET? ,CLOCK ,OPENBIT>>>
           <TELL "You'll have to open it first." CR>
           <RTRUE>)>
    <FSET ,CLOCK ,OPENBIT>
    <TELL "As you'd expect, the case holds a long pendulum.">
    <COND (<IN? ,INSIDE-GUN ,CLOCK>
           <FCLEAR ,INSIDE-GUN ,INVISIBLE>
           <TELL
" The surprise is a hand gun, pointing out into the room.">)>
    <TELL " You can also see some relays and things." CR>)