the-infocom-files / trinity

Trinity
24 stars 5 forks source link

"LOCK BOX" doesn't put the padlock back on the box #97

Open eriktorbjorn opened 4 years ago

eriktorbjorn commented 4 years ago
>OPEN BOX WITH KEY
You slip the key into the padlock. It unlocks with a smart little snap.

[Your score just went up by 1 point. The total is now 91 out of 100.]

The padlock slides off the lid of the box as you swing it open, revealing a
control panel inside.

>TAKE PADLOCK
Taken.

>TAKE KEY
You take the steel key out of the padlock.

>LOCK BOX
You swing the lid of the box shut.

The box is closed.

You snap the padlock shut.

>FIND PADLOCK
You're holding it.

>OPEN BOX
You swing open the lid of the box, revealing a control panel inside.

So the box wasn't locked. What happened? I think the clue is in the message "The box is closed." Here's what BOX-F does:

           (<AND <VERB? LOCK>
             <T? ,PRSI>>
        <COND (<T? .L>
               <ITS-ALREADY "locked">
               <RTRUE>)
              (<PRSI? TKEY>
               <TELL ,DONT "need the key to do that." CR>
               <RTRUE>)
              (<OR <PRSI? PADLOCK>
               <AND <PRSI? HANDS>
                <IN? ,PADLOCK ,PLAYER>>>
               <COND (<IS? ,PRSO ,OPENED>
                  <SET L <PERFORM ,V?CLOSE ,PRSO>>
                      <CRLF>)>
               <COND (<NOT <IN? ,PADLOCK ,PRSO>>
                  <SET L <PERFORM ,V?PUT ,PADLOCK ,PRSO>>
                  <CRLF>)>
               <SET L <PERFORM ,V?CLOSE ,PADLOCK>>
               <RTRUE>)
              (<PRSI? HANDS>
               <TELL ,DONT "have the " D ,PADLOCK ,PERIOD>
               <RTRUE>)>
        <NOT-LIKELY ,PRSI "would lock the box">
        <RTRUE>)

So you have to be carrying the padlock. That in itself seems a bit odd, because shouldn't it also work if the padlock is on the closed box? Though note that the box can be either container or surface, so that might take some testing to get right.

Anyway, the problem is probably <PERFORM ,V?PUT ,PADLOCK, PRSO> because PUT is the "PUT object IN object" action. It should probably be V?PUT-ON to put the lock on the box instead.