Is it possible, in a simple way, to have an object not visible, but present when the player is in the dark (thedark object)?
The object to grab is in real_location
, but the player is in location
(theDark).
I have a solution, but I need to hack the library.
Something like the following?
! NOTE: This is for PunyInform.
! tested with Inform 6.35 and PunyInform 3.3
Constant Story "Taking in the Dark";
Constant Headline "^(from https://intfiction.org/t/an-object-present-in-the-darkness-room/55021)^";
Include "globals";
[ InScope ;
if (location == theDark && real_location == DarkPlace && action == ##Take) ! modify as appropriate
PlaceInScope(flashlight); ! or ScopeWithin(real_location);
rfalse; ! thanks to auraes for pointing out error of omitting this
];
Include "puny";
Class Room
has light;
Room Start "Starting Point"
with description
"An uninteresting room.",
e_to DarkPlace;
Room DarkPlace "Dark Place"
with w_to Start
has ~light;
Object flashlight "flashlight" DarkPlace
with name 'flashlight',
description
"A typical flashlight.";
[ Initialise ;
location = Start;
];
This is similar to example 101 in the DM4.
Thanks. This is exactly what I needed.
There is an error in your example, rfalse
is missing at the end of InScope(); if you could correct it.
[ InScope ;
if (location == theDark && real_location == DarkPlace && action == ##Take) ! modify as appropriate
PlaceInScope(flashlight); ! or ScopeWithin(real_location);
rfalse;
];