Blue Lacuna — 58 of 467

Aaron A. Reed

Release 4

Section - Sleeping

A room has some text called the sleep message. The sleep message of a room is usually "".

A person can be either asleep or awake. A person is usually awake. Yourself is awake.

Yourself has a number called sleep debt. The sleep debt of yourself is 0.

Every turn when yourself is awake and night and player is regionally in Lacuna and the sleep debt of yourself <= 7 (this is the growing tired rule):

if a random chance of 1 in 10 succeeds begin;

add potential messages from the Table of Sleepy Messages;

increase the sleep debt of yourself by 1;

end if.

Every turn when yourself is awake and night and player is regionally in Lacuna and the sleep debt of yourself > 7 (this is the growing really tired rule):

if a random chance of 1 in 8 succeeds begin;

add potential messages from the Table of Really Sleepy Messages;

increase the sleep debt of yourself by 1;

end if.

Table of Sleepy Messages

freqstart timeend timetexttabletriggerflag
guaranteed----"You stifle a yawn[one of] and rub your eyes... you're getting tired[or]. You're starting to feel pretty tired[in random order]."

Table of Really Sleepy Messages

freqstart timeend timetexttabletriggerflag
guaranteed----"You blink away haze from your eyes blearily. You aren't sure how much longer you can stay awake."
guaranteed----"You feel dead on your feet. You really need to get some sleep."
guaranteed----"You are dead tired. Better find some place to rest."

The block sleeping rule is not listed in any rulebook. The block waking up rule is not listed in any rulebook. [ Override Inform's normal behavior.]

Sleeptime is a number that varies. Old time factor is a number that varies. Wakeup time is a time that varies. Wakeup time is 5:20 AM.

Check sleeping when location is regionally in Lacuna and it is after 5:00 AM and it is before 7:00 PM (this is the napping rule):

if already-napped is true:

say "You can only take so many naps in one day, you know. Might as well make it to sunset." instead;

otherwise if evening:

say "It's close to sunset; you might as well stay up at least till then." instead;

otherwise if an episode is playing:

say "You lay your head down and try to shut your eyes, but you seem to be too keyed up for sleep just now; thoughts and images race through your mind. Finally you stand again, resigned to wakefulness for now." instead;

otherwise if Epilogue is happening:

say "You can't. Not now." instead;

otherwise:

now already-napped is true;

if the sleep message of location is not "", say sleep message of location;

otherwise say "Yawning, you lie down and settle in for a good nap.";

print a section break;

let old_ambience be ambience_on;

now ambience_on is 0;

try waiting for two hours;

now ambience_on is old_ambience;

be more bored with "taking a nap";

say "[if good place to dream]You drowse lazily, half-aware on occasion of your surroundings, but also half-aware of something else, faint ticklings of premonition or urgent murmurs you can't quite catch, seeping up from some fuller, deeper sleep.[paragraph break][end if]You awaken a few hours later, ";

if it is after 6:00 PM, say "still feeling sleepy";

else say "feeling refreshed";

say ".";

try looking instead.

already-napped is a truth state that varies.

Dreams is a thing.

Carry out sleeping:

let xmins be 0;

now wakeup time is a random number from -50 to 20 minutes after 5:00 AM;

if the hours part of the time of day < 12, now xmins is ( 60 * -1 * the hours part of time of day ) - 60;

otherwise now xmins is ( 23 - the hours part of the time of day ) * 60;

now xmins is xmins + ( 60 - the minutes part of the time of day ) ;

now xmins is xmins + ( the hours part of wakeup time * 60 ) ;

now xmins is xmins + the minutes part of wakeup time;

now sleeptime is xmins;

if location encloses a nook (called platform) and player is not enclosed by platform, try entering platform;

if the sleep message of location is not "", say sleep message of location;

otherwise say "Yawning, you kick off your shoes and settle in for a good rest.";

if dreams are being debugged, say "// Dreams: time now: [time of day]; sleeptime [sleeptime] minutes, wakeup time: [wakeup time].";

now old time factor is time factor;

now time factor is 0; [ stop time ]

now the player is asleep.

Check waking up (this is the can't wake up if already awake rule): if the player is awake, say "But you're already awake." instead. [ See also the special rules in Lacuna-Dreams that prevent waking up from a dream early.]

pseudo-dream is a number that varies. pseudo-dream is 0.

Carry out waking up: wake up now.

To wake up now:

if yourself is awake begin;

if dreams are being debugged, say "// Dreams: wake up now: skipping since yourself already awake.";

otherwise;

if dreams are being debugged, say "// Dreams: wake up now.";

if pseudo-dream is 0 begin; [ normally time passes after a dream; if this variable is larger than 0, we don't want it to. ]

now time factor is sleeptime; [ this ensures we only have to follow the turn sequence rules once. ]

if dreams are being debugged, say "// Dreams: setting time factor to sleeptime ([sleeptime]).";

follow the turn sequence rules;

if dreams are being debugged, say "// Dreams: setting time factor to old time factor ([old time factor]).";

now time factor is old time factor; [ restart time ]

now the sleep debt of yourself is 0;

now wakeup time is 5:00 AM;

now already-napped is false;

if dreams are being debugged, say "// Dreams: advanced time to [time of day].";

end if;

update interval;

now yourself is awake;

end if.

The list of remembered stuff is a list of objects that varies.

Every thing has some text called dream-text. The dream-text of a thing is usually "".

Every turn when location is regionally in Lacuna and a random chance of 1 in 7 succeeds (this is the brain makes note of memorable things rule):

if noun is a thing and noun is enclosed by location begin;

if noun is not a person, add noun to the list of remembered stuff, if absent;

otherwise;

let macguffin be a random other thing enclosed by location;

if macguffin is a thing begin;

if macguffin is part of something (called mother), now macguffin is mother;

if macguffin is a thing, add macguffin to the list of remembered stuff, if absent;

end if;

end if;

let num be number of entries of list of remembered stuff;

if num > 25, truncate list of remembered stuff to the last 10 entries;

let num be number of entries of list of remembered stuff;

if dreams are being debugged and num > 0, say "// Dreams: adding [entry num of list of remembered stuff] to list of remembered stuff.".

The list of convo stuff is a list of objects that varies. [ Understand "lcs" as lcsing. Lcsing is an action out of world applying to nothing. Carry out lcsing: say "[list of convo stuff]". ]

[ Noticing referencable things rule is in Lacuna-Progue.]

Understand "yawn" as a mistake ("You yawn widely, starting to feel the day catching up with you. Maybe you should find a spot to get some [d]sleep[x].").

Understand "nap" or "take nap" or "take a nap" as sleeping.