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?”
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.
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.