Blue Lacuna — 74 of 467

Aaron A. Reed

Release 4

Part - Lacuna Ambience

Chapter - Ambient Messages

ambience_on is a number that varies. ambience_on is 1.

A room has a table-name called the ambience table.

A region has a table-name called the ambience table. The ambience table of a region is usually the Table of No ambience. A room has a table-name called the ambience table. The ambience table of a room is usually the Table of No ambience.

Table of No ambience

value
0

Table of Temp Messages

freqtexttabletriggerflag
a frequencytexta table-namea thinga number
with 20 blank rows

Table of Potential Messages

freqtexttabletriggerflag
a frequencytexta table-namea thinga number
with 20 blank rows

The frequency is a kind of value. The plural of frequency is frequencies. The frequencies are guaranteed, frequent, common, uncommon, rare, superrare, uberrare, and singular.

The ACO [ ambience control object] is a thing. Understand "ambience" as the ACO.

To add potential messages from (msg - a table-name), only one:

if ambience_on is 0, stop;

if ACO is being debugged, say "// Ambience: add potential messages from [msg][if only one], only one[end if].";

repeat through msg begin;

if there is a start time entry begin;

if high tide begin;

if start time entry is high tide, change flag entry to 1;

otherwise if falling uptide;

if start time entry is falling uptide, change flag entry to 1;

otherwise if falling downtide;

if start time entry is falling downtide, change flag entry to 1;

otherwise if low tide;

if start time entry is low tide, change flag entry to 1;

otherwise if rising downtide;

if start time entry is rising downtide, change flag entry to 1;

otherwise if rising uptide;

if start time entry is rising uptide, change flag entry to 1;

end if;

if there is an end time entry begin;

if start time entry <= current interval and current interval <= end time entry begin; change flag entry to 1;

otherwise if start time entry is current interval; change flag entry to 1;

end if;

end if;

otherwise;

change flag entry to 1;

end if;

end repeat;

if ACO is being debugged, say "// Ambience: [if there is a flag of 1 in msg]qualifying message(s) found.[otherwise]no qualifying message found.";

sort msg in random order;

repeat with Nvar running from 1 to the number of rows in msg begin;

if there is a flag in row Nvar of msg and flag in row Nvar of msg is 1 and the number of blank rows in Table of Potential Messages > 0 begin;

choose a blank row in Table of Potential Messages;

change freq entry to the freq in row Nvar of msg;

if there is a text in row Nvar of msg, change text entry to the text in row Nvar of msg;

if there is a table in row Nvar of msg, change table entry to the table in row Nvar of msg;

if there is a trigger in row Nvar of msg, change trigger entry to the trigger in row Nvar of msg;

if only one, let Nvar be the number of rows in msg;

end if;

end repeat;

repeat through msg begin;

change flag entry to 0;

end repeat.

To fire one off by frequency from (msg - a table-name), definitely selecting and/or no extra spacing:

[ if ambience_on is 0, stop;]

if ACO is being debugged, say "// Ambience: fire one off by frequency from [msg][if definitely selecting], definitely selecting[end if].";

if the number of filled rows in the Table of Temp Messages is 0 begin;

repeat with N running from 1 to the number of filled rows in msg begin;

choose a blank row in Table of Temp Messages;

change freq entry to the freq in row N of msg;

if there is a text in row N of msg, change text entry to the text in row N of msg;

if there is a table in row N of msg, change table entry to the table in row N of msg;

if there is a trigger in row N of msg, change trigger entry to the trigger in row N of msg;

end repeat;

end if;

repeat through Table of Temp Messages in freq order begin;

if freq entry is guaranteed begin;

change flag entry to 1;

otherwise if freq entry is frequent;

if a random chance of 1 in 2 succeeds, change flag entry to 1;

otherwise if freq entry is common;

if a random chance of 1 in 4 succeeds, change flag entry to 1;

otherwise if freq entry is uncommon;

if a random chance of 1 in 8 succeeds, change flag entry to 1;

otherwise if freq entry is rare;

if a random chance of 1 in 16 succeeds, change flag entry to 1;

otherwise if freq entry is superrare;

if a random chance of 1 in 32 succeeds, change flag entry to 1;

otherwise if freq entry is uberrare;

if a random chance of 1 in 64 succeeds, change flag entry to 1;

otherwise if freq entry is singular;

if a random chance of 1 in 128 succeeds, change flag entry to 1;

end if;

end repeat;

if ACO is being debugged, say "// Ambience: [if there is a flag of 1 in Table of Temp Messages]message found.[otherwise]no message selected.";

let success be 0;

if there is a flag of 1 in Table of Temp Messages begin;

choose row with a flag of 1 in Table of Temp Messages;

if there is a text entry begin; now success is 1; say "[text entry][unless no extra spacing][paragraph break][end if]"; end if;

if there is a table entry begin; let xz be table entry; repeat through Table of Temp Messages begin; blank out the whole row; end repeat; now success is 1; fire one off by frequency from xz, definitely selecting; end if;

if there is a trigger entry begin; now success is 1; move the trigger entry to location; change trigger entry to seen; end if;

repeat through Table of Potential Messages begin;

blank out the whole row;

end repeat;

repeat through Table of Temp Messages begin;

blank out the whole row;

end repeat;

end if;

if definitely selecting and success is 0 begin;

if ACO is being debugged, say "// Ambience: definitely selecting, so trying again.";

repeat through Table of Temp Messages begin;

if freq entry is not guaranteed, change freq entry to the frequency before freq entry;

end repeat;

fire one off by frequency from Table of Temp Messages, definitely selecting;

end if.

To decide whether okay to be ambient:

if the player is regionally in Dreamlands, decide no;

if location is regionally in Treeworld or location is regionally in Rebelworld, decide yes;

if yourself is asleep, decide no;

if dawn or sunrise or sunset or twilight or last interval is not current interval, decide yes;

if something dramatic is up, decide no;

if just had excitement, decide no; [ something interesting just happened]

if we are going or we are landmark-going, decide no;

if an [ attentive] nonbestial other person is enclosed by the location, decide no;

if conversation fuse is 0, decide no;

decide yes.

The ambient messages rule is listed last in the every turn rules. Every turn when ambience_on is 1 (this is the ambient messages rule):

if okay to be ambient begin;

if ACO is being debugged, say "// Ambience: running the ambient messages rule (because player is awake and we are not going/examining and no one is nearby).";

if ( we are examining or we are examining by name ) and ( a random chance of 1 in 2 succeeds or location is regionally in Rebelworld ) and ( last interval is current interval ) , continue the action; [ Make it less likely for ambience to distract people in the middle of something. ]

repeat with area running through region-relevant regions begin;

if a random chance of 1 in 2 succeeds and last interval is current interval, add potential messages from the ambience table of area;

end repeat;

if the ambience table of location is not the Table of No ambience and a random chance of 1 in 2 succeeds and last interval is current interval, add potential messages from the ambience table of location;

if location is outdoorsy and location is regionally in Lacuna and location is not Jumble, consider time of day ambience;

fire one off by frequency from Table of Potential Messages;

otherwise;

if ACO is being debugged, say "// Ambience: ambient messages rule NOT running (because [if player is not awake]player is not awake[end if] / [if we are going]we are going[end if] / [if something dramatic is up]nothing dramatic is up is false[end if] ).";

end if.

Definition: a region (called area) is region-relevant if the player is regionally in area and the ambience table of area is not the Table of No Ambience.

The flushing ambient messages rule is listed after the ambient messages rule in the every turn rules. Every turn when we are not landmark-going and ambience_on is 1 (this is the flushing ambient messages rule):

if ACO is being debugged, say "// Ambience: running the flushing ambient messages rule.";

repeat through Table of Potential Messages begin;

blank out the whole row;

end repeat;

repeat through Table of Temp Messages begin;

blank out the whole row;

end repeat.