the-infocom-files / witness

The Witness
3 stars 4 forks source link

"LOCK <object>" can tell you that you need to close it first, even if it's not possible to #22

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago
>LOCK WOODEN CHAIR
You'll have to close it first.

>CLOSE WOODEN CHAIR
You can't close the wooden chair.

V-CLOSE checks this to see if an object can be closed:

           (<AND <NOT <FSET? ,PRSO ,SURFACEBIT>>
             <NOT <==? <GETP ,PRSO ,P?CAPACITY> 0>>>
        <COND (<FSET? ,PRSO ,OPENBIT>
               <FCLEAR ,PRSO ,OPENBIT>
               <TELL "Closed." CR>)
              (T <TELL "It's already closed." CR>)>)
           (ELSE
        <TELL "You can't close" THE-PRSO "." CR>)>>

V-LOCK checks this:

        <COND (<FSET? ,PRSO ,OPENBIT>
               <TELL "You'll have to close it first." CR>)
              (<FSET? ,PRSO ,LOCKED>
               <TELL "It's already locked." CR>)
              (<FSET? ,PRSO ,RMUNGBIT>
               <TELL "You can't lock it. The lock is broken." CR>)
              (T
               <FSET ,PRSO ,LOCKED>
               <TELL
"Okeh," THE-PRSO " is now locked." CR>)>)

Perhaps it, too, should check for SURFACEBIT and CAPACITY?

eriktorbjorn commented 5 years ago

Still, The Witness is a lot more careful about its doors than the Zork games were. Maybe internal testing was starting to pay off?