the-infocom-files / zork2

Zork II: The Wizard of Frobozz
8 stars 4 forks source link

Looking into a sphere doesn't work as intended #4

Open eriktorbjorn opened 5 years ago

eriktorbjorn commented 5 years ago

Looking into the red sphere should show you the location of the blue sphere. But at the moment:

>LOOK IN RED SPHERE
You see only darkness.

Looking at PALANTIR-LOOK, that message is printed when:

     <SET RM <ROOM? .OBJ>>
     <COND (<OR <NOT .RM> <NOT <LIT? .RM>>>
        <TELL "You see only darkness." CR>)

OBJ is the sphere you are looking into. The ROOM? routine is defined like this:

<ROUTINE ROOM? (OBJ "AUX" NOBJ)
     <REPEAT ()
         <SET NOBJ <LOC .OBJ>>
         <COND (<NOT .NOBJ> <RFALSE>)
               (<EQUAL? .NOBJ ,WINNER> <RFALSE>)
               (<EQUAL? .NOBJ ,ROOMS> <RETURN .OBJ>)>
         <SET OBJ .NOBJ>>>

So it looks straightforward enough. If the sphere is in a room, or in a container that is in a room, the routine returns that room. Otherwise, it returns false. The blue sphere is in a lit room, so where does it go wrong?

The problem is that unfortunately there's also a macro called ROOM?:

<DEFMAC ROOM? ("ARGS" ATMS)
        <MULTIFROB HERE .ATMS>>

This is similar to VERB?, and is apparently used to test if HERE is any of a list of locations. I can't see that Zork I-III uses this macro (deliberately) anywhere. A couple of games define it, but the only game I can find that uses it is Infidel.

So we could simply remove the macro. That would make the sphere work as intended:

>LOOK IN RED SPHERE
As you peer into the sphere, a strange vision takes shape of a distant room,
which can be described clearly....

Dreary Room
This is a small and rather dreary room, eerily illuminated by a red glow
emanating from a crack in one wall. The light falls upon a dusty wooden table in
the center of the room. On the south side of the room is a massive wooden door,
which has a small window barred with iron. A formidable bolt lock is set within
the door frame. A keyhole lies within the lock. A rusty iron key is in place
within the keyhole.
The vision fades, revealing only an ordinary crystal sphere.

Though perhaps we want to change the name of the ROOM? routine instead, to avoid confusion?