the-infocom-files / trinity

Trinity
23 stars 5 forks source link

"EMPTY object" / "EMPTY object INTO object" are broken in several ways #13

Open eriktorbjorn opened 4 years ago

eriktorbjorn commented 4 years ago

When you put objects into the sculpture, SCULPTURE-F moves them to ARBOR-TOP:

     <COND (<THIS-PRSI?>
        <COND (<VERB? PUT PUT-ON THROW>
               <COND (<AND <PRSO? PARASOL>
                   <IS? ,PRSO ,OPENED>>
                  <YOUD-HAVE-TO "close" ,PRSO>
                  <RTRUE>)>
               <MOVE ,PRSO ,ARBOR-TOP>
               <SETG P-IT-OBJECT ,NOT-HERE-OBJECT>
               <TELL CTHEO
" disappears into the " D ,ENERGY "'s sparkling depths." CR>
               <RTRUE>)>
        <RFALSE>)

However, "EMPTY object INTO SCULPTURE" does not:

>EMPTY POCKET INTO SCULPTURE
The credit card: Done.

>FIND CREDIT CARD
It's in the sparkling sculpture.

That's seems to be because EMPTY-PRSO moves the object by itself, rather than using any of the other "PUT" style actions. So it needs to test for the sculpture itself, I guess?

eriktorbjorn commented 4 years ago

You can also empty your pocket into the bag of crumbs, even though you're not supposed to be able to put things in it:

>PUT CARD IN BAG
You'd probably lose the credit card in the crumbs if you did that.

>PUT CARD IN POCKET
You put the credit card in your pocket.

>EMPTY POCKET INTO BAG
The credit card: Done.
eriktorbjorn commented 4 years ago
>EMPTY POCKET INTO POND
The your pocket disappears in the dark water.

It's probably interpreted as "PUT POCKET IN POND" by HANDLE-WATER? or something like that:

              (<INTBL? ,PRSA ,PUTVERBS ,NUMPUTS>
               <COND (<OR <PRSO? BALL CRANE>
                  <AND <PRSO? PARASOL>
                       <IS? ,PRSO ,OPENED>>>
                      <TELL CTHEO
                    " might float out of reach" ,IF-YOU-DID>
                      <RTRUE>)>
               <VANISH>
               <TELL CTHEO>
               <COND (<PRSO? OCRANE BAD-CRANE>
                      <TELL " floats away ">)
                     (T
                      <TELL " disappears ">)>
               <SAY-IN-WATER>
               <RTRUE>)

V?EMPTY-INTO is one of the PUTVERBS, but PRSO would be the container, not the thing you tried to put in the water.

This can also be seen in other places, later in the game:

>EMPTY CAGE INTO RIVER
Splash! The birdcage disappears into the dark water.
>EMPTY POCKET INTO CHASM
The your pocket disappears into the chasm.

>EMPTY ME INTO CHASM
The yourself disappears into the chasm.

>EMPTY HANDS INTO CHASM
The your hand disappears into the chasm.
eriktorbjorn commented 4 years ago

It also only handles the first object:

>LOOK IN POCKET
You have a seven-sided coin and a credit card in your pocket.

>EMPTY POCKET INTO PRAM
The seven-sided coin: Done.

I think this is because EMPTY-PRSO is supposed to loop through the contents of PRSO, it actually doesn't. It sets OBJto <FIRST? ,PRSO> before the REPEAT, and it sets OBJ to NXT near the end of it. But it never actually sets NXT (compare this to e.g. V-INVENTORY) so that's always 0.

Plain "EMPTY POCKET" works the same:

>LOOK IN POCKET
You have a seven-sided coin and a credit card in your pocket.

>EMPTY POCKET
[into your hands]

The seven-sided coin: Taken.

Of course, that's just a simple matter of adding <SET NXT <NEXT? .OBJ>>. I feared that this would cause "EMPTY POCKET INTO POCKET" to go into an infinite loop, but apparently not. (It's still a silly command to accept, though.)

eriktorbjorn commented 4 years ago

It also doesn't check if the objects fit:

>PUT COIN IN THREADED HOLE
The seven-sided coin is too big to fit in the threaded hole.

>PUT COIN IN POCKET
You put the seven-sided coin in your pocket.

>EMPTY POCKET INTO THREADED HOLE
The seven-sided coin: Done.
eriktorbjorn commented 4 years ago
>EMPTY WALKIE-TALKIE INTO POCKET
The antenna: Done.

This bug report is going to be just awful...

eriktorbjorn commented 4 years ago
>PUT COIN IN THREADED HOLE
The seven-sided coin is too big to fit in the threaded hole.

>PUT COIN IN POCKET
You put the seven-sided coin in your pocket.

>EMPTY POCKET INTO THREADED HOLE
The seven-sided coin: Done.

>FIND COIN
It's in the threaded hole.

Oh dear...

eriktorbjorn commented 4 years ago
>PUT COIN ON PEDESTAL
The giant book completely covers the pedestal.

>PUT COIN IN POCKET
You put the small coin in your pocket.

>EMPTY POCKET INTO PEDESTAL
The small coin: Done.
eriktorbjorn commented 4 years ago

Not to mention that EMPTY-PRSO itself is broken so that it moves at most one object:

>LOOK IN POCKET
You have a seven-sided coin and a credit card in your pocket.

>EMPTY POCKET
[into your hands]

The seven-sided coin: Taken.

That's because the termination condition for the loop is this:

         <SET OBJ .NXT>
         <COND (<ZERO? .OBJ>
            <RETURN>)>>

But NXT is never set, so it's always 0 causing the loop to terminate after the first object has been moved.

eriktorbjorn commented 4 years ago

Here's another example:

>PUT CARD IN RESERVOIR
You put the credit card over the side of the reservoir. Splash!

>EMPTY POCKET INTO RESERVOIR
The small coin: Done.

>GET COIN
You take the small coin out of the reservoir.
eriktorbjorn commented 4 years ago
>EMPTY CAGE INTO POCKET
The bag of crumbs: Done.

The roadrunner struggles out of your grasp and lands at your feet.

The bird spies the paper bag. It leaps into your pocket and begins to peck at
the crumbs in the bag.