OffersLight hangs with PunyInform

I’m building a game with PunyInform and want to change a room description to reflect whether the room below is illuminated (either with the light property or by having an NPC holding a light there). My code generally works, but my game hangs with this code:

Object CryptStairs "Crypt Stairs"
  with
    name 'crypt' 'stairs',
    description [;
      print
        "At the midpoint of these stairs, you can sense the damp
        below. A thin veil of light comes from the altar area above";
        if (OffersLight(Crypt))         <-- problem here
          ", and a similar weak light from the crypt below.^";
          ", but the path down descends into darkness.^";
      ],
      s_to CryptGate,
      u_to CryptGate,
      d_to Crypt,
      before [;
        Smell: "Musty and damp.";
      ],
  has light;

When I arrive in this location, my game hangs without any error. If I change if (OffersLight(Crypt)) to if (true), it doesn’t hang, so it appears that OffersLight is the problem.

Is this a routine I should be able to use in PunyInform? If not, is there a similar technique for “is this room illuminated?”

Thanks for any help!

(sorry, just noticed it wasn’t hanging with OffersLight; it wasn’t compiling at all!)

But, the greater question stands: is there a replacement for OffersLight for PunyInform?

I guess you could copy the private _LookForLightInObj from the library source and adapt it for your needs?

OffersLight() is not supported by PunyInform, which is a bit of a nuisance. You can either change the test to something more specific to your game or copy the OffersLight() routine from the standard library. I’ve normally done the former.

That is a great suggestion, and works just fine. Thanks, @pontusi !

I was considering using a specific check of “are any of the monks (a class) in the crypt” as a game-specific proxy for this, since they’re the only ones who might carry light, but @pontusi ‘s suggestion for _LookForLightInObj seems more general for this case (just in case other game logic changes).

Thanks for chiming in on this – I’m particularly happy since I’ve played a few of your games and enjoyed them.

2 Likes