It seems Inform 7 won’t accept a command like “Now every room is dark.” What can I type to make every room in my game dark?
There may be a better way to do this, but you can always repeat through. This means going through a collection of something (rooms in this case), and acting on each individually. Note that “place” is a name I chose. It could be anything that isn’t already reserved.
instead of jumping: repeat with place running through rooms: now place is dark; say "[place]: [if place is dark]dark[otherwise]lighted[end if].";
Hm? Sure it does.
When play begins: now every room is dark.
How embarrassing! I didn’t check.
Please share your code, TC
Also, please share the error you got. That’s way more useful than saying “Inform didn’t accept it.”
"Now every room is dark” is valid code. It will make every room dark. But it’s temporal code. That is, it can’t just be a line sitting in your source in general. You have to code it into an action or event in the game that makes it happen.
If you wanted all rooms dark at the beginning, that event could be the game starting.
I tried this:
When play begins: now every room is dark;
Unfortunately, I discovered this won’t catch the room the player starts in on the first turn. After the first command, the player will get the message ‘It is now pitch dark in here!’ – i.e. they witnessed the code running making everything dark.
If you want all rooms already dark when the game begins, you can instead say this in your source:
A room is usually dark.
This makes it so the default state of a room, when the source adds one, is to be dark. So this code is setting things up before play begins.
On the other hand, if something happens in your game which is going to make every room dark, you need to connect the other way of doing it to an action.
Here’s a (silly) example. If you wanted the world to turn dark the first time the player jumped, you could do this:
Carry out jumping for the first time: now every room is dark;
If you wanted the lights to go out every time they jumped, you’d remove the ‘for the first time’ bit:
Carry out jumping: now every room is dark;
Oh, sorry. It seems I mistyped something. Never mind.