For my project, I’m using four recurring scenes–called dawn, day, dusk, night–to organize each day into time periods. This is one of the examples provided by Inform 7. Here’s the code, which may look familiar:
[spoiler]The sun is a backdrop. It is everywhere. The description is “The sun blazes in the sky.”
Night is a recurring scene. Night begins when Dusk ends. Night ends when the time since night began is 15 minutes. Night ends when Slumber ends.
When Night begins:
say “The sun sinks into the distance and the island falls into shadows.”;
now the description of the sun is “The sun is out of sight. Just like all hope of rescue.”
Dawn is a recurring scene. Dawn begins when play begins. Dawn begins when Night ends. Dawn ends when the time since Dawn began is 5 minutes [gotta fanagle with time intervals, prolly work with turns]. Dawn ends when Slumber ends.
When Dawn begins:
say “The sun rises, casting rays of gold and sapphire over the island, driving away the darkness.”;
now the description of the sun is “The sun is rising. Maybe you’ll be rescued soon.”
Day is a recurring scene. Day begins when Dawn ends. Day ends when the time since Day began is 15 minutes [fanagle, too]. Day ends when Slumber ends.
When Day begins:
say “The sun has fully risen.”
Dusk is a recurring scene. Dusk begins when Day ends. Dusk ends when the time since Dusk began is 5 minutes. Dusk ends when Slumber ends.
When Dusk begins:
say “The sun has fallen from its zenith. It begins its descent into the horizon.”[/spoiler]
However, this way of organizing time periods doesn’t seem to meet my purposes. For one, I want the player to be able to sleep through a time period. (“If it is day and he falls asleep, now he is awake and it is evening” something or another…). But I don’t know how to achieve this.
This is some of my own code:
[spoiler]Instead of sleeping:
if the player is in the sleepsack:
if the campfire is in the Beach:
say “You go to sleep…”;
now the player is asleep;
if the player is asleep:
now the player is awake;
otherwise:
say “You should light a campfire before going to bed.”;
otherwise:
say “It’s not very comfortable for sleeping here.”
A person can be awake or asleep. The player is awake.
Slumber is a scene. Slumber begins when the player is asleep. Slumber ends when the player is awake.
When Slumber ends:
say “Several hours later, you awaken.”[/spoiler]
I’m sure if I could direct the Slumber scene to begin and end when the player is either sleeping or awake, respectively, then as long as time period scenes end when Slumber ends, this would work. But I might also need a totally different approach, I just don’t know.
Your help is immensely appreciated. Sorry if I’ve posted this topic in the wrong thread.