The following code is taken from example 24: Down Below and works fine as a standalone.
[code]Master Bedroom is a room. “You are in what appears to be the master bedroom.” The light switch is a switched on device in the Master Bedroom. It is fixed in place.
Carry out switching off the light switch: now the Master Bedroom is dark.
Carry out switching on the light switch: now the Master Bedroom is lighted.
After deciding the scope of the player:
place the light switch in scope.[/code]
However, when I place the exact same code into my game, it doesn’t work:
I haven’t used light anywhere else in the game, nor have I used ‘scope’ or anything else I can see as clashing.
Is there any reason why this would not be implemented in a game when it works fine as an example?
I have only used the locksmith extension, and no other ‘device’.
No reason I can see why this shouldn’t work; I’ve checked with Locksmith and there’s no obvious incompatibility there, either. (I am able to assemble an example that includes this code and Locksmith, and seems to run fine.) Some ways to troubleshoot this kind of problem:
– look through your Indices. Make sure that the Kinds Index and World Index both show that you’ve created all the objects you wanted (and only the objects you wanted) and that you haven’t accidentally made two things with quite similar names where you meant to make one;
– try inserting some say phrase into your scope rule to see whether it is actually happening, which may help indicate where the problem is.
One (unrelated) caveat: if you have more than one room, you probably want
After deciding the scope of the player when the player is in the Master Bedroom:
place the light switch in scope.
or else when you get this working again the light switch will be accessible from everywhere. (I’ve actually amended this in the example for the next version of Inform, but of course it is not out yet.)