"""The frame story: the cover, the menus, the bottles, the meanings, and the ending. This is the part of the Inform source (sourceCode.txt) that runs the game around the generated text: `When play begins`, the menus (`Abooting`, `Endnoting`, `Contentwarning`, `modeselection`), the two play modes, and the game itself (`Selecting`, `stock possibility`, `bottle-preamble`, the full-scent rule, `suggest semantics`, `endgame`). Each method names the rule it ports and where it is in the source (line numbers are in sourceCode.txt, which the web page serves as source.txt). The generated text comes from engine.py, which expands the corpus the same source defines; screen.py puts it all on the page. How Inform prints, and what this module keeps of it: * `say "..."` prints the text, and a text that ends in a full stop, question mark or exclamation mark gets a line break after it. * `[p]` is a paragraph break: a line break, with one more before it if anything has been printed since the last paragraph break (Inform's `say__p`; here `paragraph_open`). * `[br]` is a line break. * At the end of each turn, if anything has been printed since the last paragraph break, one more line break. * Text the source builds before printing it (each entry `pop` picks, and wherever it says `the substituted form of`) starts its own paragraph, so a `[p]` at its start is only a line break; and a wait for a key inside it comes before any of it is printed. engine.py's `expand` builds text that way, and its `evaluate` gives text to `say`. The game waits for the player in two ways: `wait for any key` (a key or a click), and the next command, which the page's links send ("about", "advance", "3"...). Both are awaits, so each method reads in the order its rule does. """ from __future__ import annotations import json from pathlib import Path from typing import NamedTuple from .engine import AWAIT, MARK, Engine, sentence_case DATA = Path(__file__).parent / "data" / "corpus.json" STANDARD, REFLECTIVE = "standard-mode", "reflective-mode" # `The duration of a play-mode is usually 7` (sourceCode.txt:1525); `The duration of reflective-mode is 2` (:1632) DURATION = {STANDARD: 7, REFLECTIVE: 2} # `faster-icon-index` (sourceCode.txt:2085): one of the sixteen icons, in a random order, in one of its five colours FASTER_ICON_INDEX = ( "[one of][pop icon-list1][or][pop icon-list2][or][pop icon-list3][or][pop icon-list4][or][pop icon-list5]" "[or][pop icon-list6][or][pop icon-list7][or][pop icon-list8][or][pop icon-list9][or][pop icon-list10]" "[or][pop icon-list11][or][pop icon-list12][or][pop icon-list13][or][pop icon-list14][or][pop icon-list15]" "[or][pop icon-list16][in random order]" ) # The link that ends the evening, once there have been enough perfumes (sourceCode.txt:2059) ENOUGH = ( "[one of]That's enough for one night[or]Actually, you're done for the night[or]That's enough[or]Enough" "[or]You've remembered enough for now[or]No, you've remembered all you need to[or]You're done here" "[or]It suffices. Enough[or]Time for bed[at random]." ) # `To theme-resonance` (sourceCode.txt:865): what each theme adds to the meanings on offer, and the season it sets THEME_RESONANCE = { "goth": ["melancholy", "loss"], "ancient": ["endurance"], "mystic": ["spirituality", "dionysian"], "woodland": ["solitude", "nature", "growth"], "glam": ["fashion", "beauty"], "spring": ["beginnings", "fun"], "fall": ["endings", "melancholy"], "winter": ["endurance", "stillness"], "lewd": ["lust"], } THEME_SEASON = {"spring": "spring", "summer": "summer", "fall": "autumn", "winter": "winter"} class Option(NamedTuple): """A row of the Table of Present Options (sourceCode.txt:1875): a meaning on offer, or RETRY or FAIL.""" note: str meaning: str menu_text: str class Imp(NamedTuple): """A row of the Table of Imps (sourceCode.txt:1992): a bottle on offer, or END.""" theme: str | None desc: str class Symbol(NamedTuple): """A row of the Table of Enduring Symbols (sourceCode.txt:2390): a scent, what it stands for, and its icon.""" note: str meaning: str iconic: str class Story: def __init__(self, screen, corpus: dict | None = None, seed=None): if corpus is None: corpus = json.loads(DATA.read_text(encoding="utf-8")) self.screen = screen self.engine = Engine(corpus, seed=seed) self.state = self.engine.state self.themes = list(corpus["themes"]) self.uniquelist = list(corpus["lists"]["uniquelist"]) self.paragraph_open = False # Inform's say__p # The source's variables, as it starts them self.current_menu = "intro." # :57 self.advnum = 0 # :125 self.banner_num = 1 # :126 self.play_mode = STANDARD # :1602 self.selecting_mode = False # :1596 self.play_length = 7 # :1997 self.stop_offered = False # :1999 self.full_stocking = True # :2000 self.choose_mode = 0 # :1967 self.bottlecount = 0 # :2161 self.try_counter = 0 # :2277 self.present_options: list[Option] = [] self.imps: list[Imp] = [] self.symbols: list[Symbol] = [] @property def play_mode(self) -> str: """`The current play-mode`; the engine reads it too.""" return self.engine.play_mode @play_mode.setter def play_mode(self, mode: str) -> None: self.engine.play_mode = mode # -- Printing -------------------------------------------------------------------------------------------------- def say(self, text: str) -> None: """`say "..."`: print the text, and the line break a final . ? or ! asks for.""" self.print(self.engine.evaluate(text)) if text.endswith((".", "?", "!")): self.line_break() async def say_with_pauses(self, text: str) -> None: """`say` for a perfume and its memory, which can wait for a key while it's being made (the `[await]` in the escape memory): print what comes before the wait, wait, and print the rest.""" first, *rest = self.engine.evaluate(text).split(AWAIT) self.print(first) for part in rest: await self.screen.wait_for_key() self.print(part) if text.endswith((".", "?", "!")): self.line_break() def print(self, text: str) -> None: """Print evaluated text: its words, and what the marks engine.py leaves in it ask for.""" at = 0 for mark in MARK.finditer(text): self.print_words(text[at : mark.start()]) at = mark.end() kind = mark.group(1) if kind == "p": self.paragraph_break() elif kind == "br": self.line_break() elif kind == "i": self.screen.style("italic") elif kind == "b": self.screen.style("bold") elif kind in ("/i", "/b"): self.screen.style("roman") # both are Inform's `roman type` self.print_words(text[at:]) def print_words(self, words: str) -> None: if words: self.screen.print(words) self.paragraph_open = True def line_break(self) -> None: self.screen.print("\n") def paragraph_break(self) -> None: if self.paragraph_open: self.screen.print("\n") self.paragraph_open = False self.screen.print("\n") def place_link_to_command(self, command: str, text: str) -> None: """`place a link to the command "..." reading "...", without showing the command`.""" self.screen.open_command_link(command) self.print(text) self.screen.close_tag() def place_link_to_web_site(self, url: str, text: str, same_window: bool = False) -> None: """`place a link to web site "..." reading "..."`; a new window unless `opening in the same window`.""" self.screen.open_web_link(url, new_window=not same_window) self.print(text) self.screen.close_tag() # -- The order of play ----------------------------------------------------------------------------------------- async def play(self) -> None: """Start the game, then play a turn for each command, for as long as the page is open.""" self.screen.print("\n\n\n") # Inform's blank lines before anything else await self.when_play_begins() self.paragraph_break() while True: command = await self.screen.read_command() await self.turn(command) if self.paragraph_open: # the end of the turn self.line_break() self.paragraph_open = False async def turn(self, command: str) -> None: """Do what a command asks: the commands are the ones the page's links send.""" command = " ".join(command.lower().split()) if command.isdigit(): # `After reading a command` (sourceCode.txt:1880): a number is `selecting` that number await self.selecting(int(command)) return actions = { "about": self.abooting, "endnote": self.endnoting, "warning": self.contentwarning, "mode": self.modeselection, "advance": self.advancing, "k": self.kyping, } if command in actions: await actions[command]() elif command in ("examine standard-mode", "examine reflective-mode"): await self.examining(command.split()[1]) elif command in ("yes", "no"): self.say("That was a rhetorical question.") # Inform's answer to a yes or no nobody asked for else: self.say("That's not a verb I recognise.") # -- The cover and the menus ----------------------------------------------------------------------------------- async def when_play_begins(self) -> None: """`When play begins` (sourceCode.txt:132): the Heavy Petal card, then the cover with its menu.""" s = self.screen s.preload(["heavypetal2a.png", "modalbar.jpg", "scents-semiosis.jpg"]) s.open_tag("div", "firstpetal") s.image("heavypetal2a.png", "Heavy Petal", centered=True) s.close_tag() s.open_tag("div", "petalfade") s.image("scents-semiosis.jpg", "Cover art", centered=True) self.show_opt_list() s.close_tag() await s.wait_for_key() s.hide("firstpetal") s.add_class("petalfade", "fadein") await s.wait_for_key() s.focus("petalfade") # The release then hides Vorple's command line (`hide the prompt`); this page never shows one. def show_opt_list(self) -> None: """`To show opt-list` (sourceCode.txt:156): source code, about, play, modes, content.""" s = self.screen s.open_tag("table", "initial-options") s.open_tag("tr") s.open_tag("td", "thicc") self.place_link_to_web_site("source.html", "source code") s.close_tag() for command, label in [("about", "about"), ("advance", "play"), ("mode", "modes"), ("warning", "content")]: s.open_tag("td", "thicc") self.place_link_to_command(command, label) s.close_tag() s.close_tag() s.close_tag() async def abooting(self) -> None: """`Instead of abooting` (sourceCode.txt:61): the credits, with the menu under them or a pause after.""" if self.current_menu == "about": return self.current_menu = "about" s = self.screen s.focus_main() s.remove("initial-options") s.remove("petalfade") s.remove_all("modechoices") s.remove_all("warntext") self.banner_num = 2 s.open_tag("table", "abouttable") s.open_tag("tr") s.open_tag("td", "flowerbar") s.image("modalbar.jpg", "floral sidebar") s.close_tag() s.open_tag("td") s.open_tag("span", "bannertext") self.say_banner_text() s.close_tag() self.say( "For Emily Short.[p]Heavy Petal, which does not exist, is Sam Kabo Ashwell; production by Cat Manning; " "and contributions from Yoon Ha Lee, Cat Manning and Caleb Wilson. Testing: Jacqueline Ashwell. " "Illustration and layout: Sam Kabo Ashwell.[p]Cover art: wild wisteria, detail of [i]Flowering Plants " "and Vegetables of the Four Seasons[/i], early C18th Japanese [i]Rinpa[/i]-style folding screen, " "Metropolitan Museum of Art." ) s.close_tag() s.close_tag() s.close_tag() if self.advnum == 0: self.show_opt_list() else: await s.wait_for_key() s.remove("abouttable") def say_banner_text(self) -> None: """`[banner text]`: Inform's banner, Vorple's credit line, and the release's `After printing the banner text` rule (sourceCode.txt:122), as the release printed them.""" self.screen.style("bold") self.print_words("Scents and Semiosis") self.screen.style("roman") self.line_break() self.print_words("An Interactive Fiction by Heavy Petal") self.line_break() self.print_words("Release 1 / Serial number 200310 / Inform 7 build 6M62 (I6/v6.33 lib 6/12N) ") self.line_break() self.print_words("Vorple version 3.0 preview") self.line_break() self.say("Update 1.2 [b]Fenugreek[/b][p]") async def endnoting(self) -> None: """`Instead of endnoting` (sourceCode.txt:93): the endnotes, until a key.""" if self.current_menu == "endnote": return self.current_menu = "endnote" self.banner_num = 2 s = self.screen s.open_tag("table", "abouttable") s.open_tag("tr") s.open_tag("td", "flowerbar") s.image("modalbar.jpg", "floral sidebar") s.close_tag() s.open_tag("td") self.say( "[i]Scents & Semiosis[/i] was designed as a gift for Emily Short, according to an approach she has " "spoken of fondly: crafting a game for a target audience of one. It is released to the public with her " "permission.[p]This is an incomplete project. Like many works built around procedurally generated " "content, its incompleteness is sort of baked in. The basic method of generation makes use of a " ) self.place_link_to_web_site("http://www.brightspiral.com/", "Tracery") self.say("-like system that was originally developed for ") self.place_link_to_web_site("http://samkabo.com/ApocalypseFuel", self.engine.evaluate("[i]Apocalypse Fuel[/i]")) self.say( ", expands it considerably, pilfers from its corpus, and runs up against its limits in several places." "[p]The perfumes described ignore some fairly basic principles of real-world perfume composition; given " "the alternate world implied by the story, we didn't want to overconstrain our possibilities. Consider " "them hopeful monsters rather than exactingly-bred show animals.[p]In the real world, perfumes fade " "considerably faster than the story's conceit suggests. Do not try to store a beloved perfume for " "decades. " ) s.close_tag() s.close_tag() s.close_tag() s.scroll_to_end() await s.wait_for_key() s.remove("abouttable") async def contentwarning(self) -> None: """`Instead of contentwarning` (sourceCode.txt:178): what the memories touch on.""" if self.current_menu == "content": return self.current_menu = "content" s = self.screen s.focus_main() s.remove("petalfade") s.remove_all("abouttable") s.remove_all("initial-options") s.remove_all("modechoices") s.place_block("warntext") s.focus("warntext") self.say( "The events of Scents & Semiosis are described in memory: you do not choose what the player character " "[i]did[/i], but rather how she feels about the memory now. These memories may reference:[p]the death, " "disappearance or loss of friends and relatives[br]sex and sexual situations[br]oppressive, tumultuous " "or threatening political regimes[br]food and alcohol." ) self.show_opt_list() async def modeselection(self) -> None: """`Instead of modeselection` (sourceCode.txt:1531): Story and Mirror, each with its picture.""" if self.current_menu == "modes": return self.current_menu = "modes" self.selecting_mode = True s = self.screen s.focus_main() s.remove("petalfade") s.remove_all("abouttable") s.remove_all("initial-options") s.remove_all("warntext") s.place_block("modechoices") s.focus("modechoices") for picture, art, command, name, blurb in [ ("mode1.png", "Mode 1 art", "examine standard-mode", "Story", "Re-assess memories of a varied life. Recommended for your first play."), ("mode2.png", "Mode 2 art", "examine reflective-mode", "Mirror", "A shorter version, more suited to reflecting on concepts rather than piecing together implied story."), ]: s.open_tag("div", "clearfix") s.open_tag("span", "modeimg") s.image(picture, art) s.close_tag() s.open_tag("div", "modetxt") s.open_tag("h2") self.place_link_to_command(command, name) s.close_tag() self.say(blurb) s.close_tag() s.close_tag() s.close_tag() self.show_opt_list() async def examining(self, mode: str) -> None: """`Instead of examining a play-mode` (sourceCode.txt:1588): choose the mode and begin.""" self.play_mode = mode self.selecting_mode = False self.screen.remove_all("modechoices") self.advnum = 1 self.play_length = DURATION[mode] self.execute_the_overture() # -- The opening ----------------------------------------------------------------------------------------------- def execute_the_overture(self) -> None: """`To execute the overture` (sourceCode.txt:6091): clear the menus and set the scene.""" s = self.screen s.focus_main() s.remove("petalfade") s.remove_all("abouttable") s.remove_all("initial-options") s.remove_all("warntext") s.place_block("maintext") s.focus("maintext") if self.play_mode == STANDARD: self.say( "There are other perfume-boxes, other lists, sharply curated according to audience. You allow " "yourself a degree of sentiment in their selection, but that too serves a public purpose. This " "collection - messy, unfashionable, incoherently themed - is an entirely private matter. " ) self.place_link_to_command("advance", "A giant's secret heart.") elif self.play_mode == REFLECTIVE: self.advnum = 2 self.banner_num = 2 self.say( "This is how you talk to yourself best. A question to turn over, perhaps; or a practice, an " "arrangement of elements, a new weaving from threads of familiar cloth. You might be looking for " "something in particular, or waiting to see what you find. You know this language.[p]" ) self.place_link_to_command("k", "You will not need long.") async def advancing(self) -> None: """`Instead of advancing` (sourceCode.txt:6111): from the cover, the overture; then Story's second part.""" if self.advnum == 0: self.current_menu = "gameplay" self.execute_the_overture() self.advnum = 1 elif self.advnum == 1: if self.play_mode == STANDARD: self.say( "[br]Each scent brings back memories that once meant something important. They might still. " "But scents change their character as they slowly break down, and history moulders unless given " "air. Once in a while you clear an evening, unlock the chest, and unstopper your old selves to " "see " ) self.place_link_to_command("k", "what they are to you now.") self.advnum = 2 self.banner_num = 2 async def kyping(self) -> None: """`Carry out kyping` (sourceCode.txt:6132): open the casket and offer the first bottles.""" self.screen.clear("maintext") await self.stock_possibility() await self.bottle_preamble() self.offer_bottle_choice() # -- Bottles --------------------------------------------------------------------------------------------------- async def stock_possibility(self) -> None: """`To stock possibility` (sourceCode.txt:2002): three bottles, and a way out once there are enough perfumes. Mirror asks once, when it has run its length, whether that is enough.""" self.full_stocking = True if self.play_mode == REFLECTIVE and len(self.symbols) > self.play_length and not self.stop_offered: s = self.screen await s.wait_for_key() self.say( "When you began, you were planning a brief session; something about this long. Does this feel like " "enough?" ) self.stop_offered = True s.place_block("interrupt-choice") s.focus("interrupt-choice") self.place_link_to_command("yes", "I've got what I need.") self.say("[br]") self.place_link_to_command("no", "I'm not quite done yet.") if await self.player_consents(): s.focus("maintext") s.remove("interrupt-choice") self.full_stocking = False await self.endgame() else: s.focus("maintext") s.remove("interrupt-choice") self.say("[p]Sometimes it takes a little more than you planned. Take however long you need.") await s.wait_for_key() if self.full_stocking: self.imps = [] for _ in range(3): theme = self.engine.pick(self.themes) # `a random permitted theme`: every theme is permitted self.state.themelist[:] = [theme] self.imps.append(Imp(theme, self.engine.expand("[pop bottlepats]"))) if len(self.symbols) > self.play_length: self.imps.append(Imp(None, "END")) self.state.themelist.clear() async def player_consents(self) -> bool: """`if the player consents`: Inform's yes-or-no question, answered here by the two links.""" while True: answer = (await self.screen.read_command()).strip().lower() if answer in ("yes", "y"): return True if answer in ("no", "n"): return False self.say("Please answer yes or no.") self.print_words("> ") async def bottle_preamble(self) -> None: """`To bottle-preamble` (sourceCode.txt:2163): the casket the first time; after that, a pause, a line on how far the evening has gone, and another pause.""" self.bottlecount += 1 s = self.screen if self.bottlecount == 1: s.clear("maintext") self.say( "The casket is deliberately not organised in any particular way, and you avoid the impulse to go " "through it in order; your other routines have system enough. You run a hand through the vials, as " "though dangling your arm from a boat to touch the water, and pick out one, two, a third, for any " "reason or none.[p]" ) else: await s.wait_for_key() s.clear("maintext") self.say(self.phasebottle() + ": ") await s.wait_for_key() def phasebottle(self) -> str: """`To say phasebottle` (sourceCode.txt:2180): early, middling or late in the evening.""" if self.play_mode == REFLECTIVE: return "[one of][pop nextbottle][or][pop earlybottle][purely at random]" if len(self.symbols) < 3: return "[pop earlybottle]" if len(self.symbols) < 6: return "[pop nextbottle]" return "[pop latebottle]" def offer_bottle_choice(self) -> None: """`To offer bottle-choice` (sourceCode.txt:2049): a link for each bottle, as a numbered command.""" s = self.screen s.open_tag("table", "choicelist") for number, imp in enumerate(self.imps, start=1): s.open_tag("tr") s.open_tag("td", "choiceopt") self.place_link_to_command(str(number), self.engine.evaluate(ENOUGH) if imp.desc == "END" else imp.desc) s.close_tag() s.close_tag() s.close_tag() # -- Choosing -------------------------------------------------------------------------------------------------- async def selecting(self, number: int) -> None: """`Selecting` (sourceCode.txt:1888): a number picks a bottle, or what its scent means.""" s = self.screen if self.choose_mode == 1: if not 1 <= number <= len(self.present_options): # `Check selecting while choose-mode is 1` self.say(f"{number} is not a valid option.") self.offer_choices() return # `Carry out selecting while choose-mode is 1` s.remove("choicelist") option = self.present_options[number - 1] if option.note == "RETRY": self.try_counter += 1 self.suggest_semantics() self.offer_choices() elif option.note == "FAIL": s.clear("maintext") if self.play_mode == STANDARD: self.say("The memory doesn't mean what it used to. Perfumes fade. You set it aside. ") elif self.play_mode == REFLECTIVE: self.say("Not everything you find has to be useful. ") self.say("[p][pop somethingelse].") self.try_counter = 0 self.run_cleanup() self.choose_mode = 0 await self.stock_possibility() # No bottle-preamble here, the source says: that would imply a chosen meaning, and count it if self.full_stocking: self.offer_bottle_choice() else: text = f"{sentence_case(option.note)} for {option.meaning}" if self.engine.chance(3, 4): text += ". " + self.engine.evaluate("[pop memoryconfirm]") self.print(text + ".") self.paragraph_break() self.try_counter = 0 icon = self.engine.expand(FASTER_ICON_INDEX) s.preload([icon]) self.symbols.append(Symbol(option.note, option.meaning, icon)) self.run_cleanup() self.choose_mode = 0 await self.stock_possibility() if self.full_stocking: await self.bottle_preamble() self.offer_bottle_choice() else: if not 1 <= number <= len(self.imps): # `Check selecting while choose-mode is 0` self.say(f"{number} is not a valid option.") self.offer_bottle_choice() return # `Carry out selecting while choose-mode is 0` s.clear("maintext") imp = self.imps[number - 1] if imp.desc == "END": self.say( "You have time for more, and your nose isn't losing sensitivity yet. But this is not a process " "that you will ever complete, and perhaps it's enough for one evening.[p]" ) await s.wait_for_key() await self.endgame() else: self.state.themelist.append(imp.theme) self.choose_mode = 1 await self.full_scent_rule() async def full_scent_rule(self) -> None: """The full-scent rule (sourceCode.txt:6150): the perfume and the memory it brings back; then, after a key, what it might mean.""" self.themepick() uniques = not (self.play_mode == REFLECTIVE and self.bottlecount > 1) if self.uniquelist and self.engine.chance(1, 7) and uniques: unique = self.engine.pick(self.uniquelist) # a memory that comes up only once self.uniquelist.remove(unique) await self.say_with_pauses("[uppop structures]. " + unique + ". ") else: await self.say_with_pauses("[uppop structures]. [pop memories][frag]. ") await self.screen.wait_for_key() if self.play_mode == REFLECTIVE and self.bottlecount == 1: self.say( "[p]The hope is not to redefine the memory, but to use it as a starting-point. What does this suggest " "for you now?" ) self.suggest_semantics() self.offer_choices() def themepick(self) -> None: """`To themepick` (sourceCode.txt:850): sometimes a second theme; then what each theme resonates with.""" themelist = self.state.themelist if self.engine.chance(1, 3): themelist.append(self.engine.pick([theme for theme in self.themes if theme != themelist[0]])) for theme in list(themelist): self.state.assoc_list.extend(THEME_RESONANCE.get(theme, [])) if theme in THEME_SEASON and self.state.current_season == "none": self.state.current_season = THEME_SEASON[theme] def temp_associate(self) -> None: """`To temp-associate` (sourceCode.txt:2310): gather what the scent could mean into the meaning-store.""" s, expand = self.state, self.engine.expand store = s.meaning_store store.clear() while len(store) < 3: store.append(expand("[noreppop rand-res]")) for name in s.assoc_list: s.expandable_assoc = False meaning = expand(f"[pop {name}]") if s.expandable_assoc: s.assoc_holder = meaning meaning = expand("[pop semirand-res]") if len(meaning) > 1: store.append(meaning) store.extend(s.socdirect) while len(store) < 4: meaning = expand("[noreppop rand-res]") if len(meaning) > 1: store.append(meaning) def suggest_semantics(self) -> None: """`To suggest semantics` (sourceCode.txt:2374): four of those meanings, and the ways out.""" self.present_options = [] self.temp_associate() meanings = list(self.state.meaning_store) self.engine.rng.shuffle(meanings) for meaning in meanings[:4]: note = self.engine.expand("[pop notelist]") menu_text = f"{note} {self.engine.expand('[pop implications]')} {meaning}" self.present_options.append(Option(note, meaning, menu_text)) if self.try_counter < 3: # `To add refresh` self.present_options.append(Option("RETRY", "", "None of these feel right. Reconsider. ")) if self.try_counter > 0: # `To add failure` if self.play_mode == REFLECTIVE: self.present_options.append(Option("FAIL", "", "This doesn't fit with what you had in mind.")) else: self.present_options.append(Option("FAIL", "", "This perfume isn't worth keeping. ")) def offer_choices(self) -> None: """`To offer choices` (sourceCode.txt:1945): a link for each option, then scroll to them.""" s = self.screen s.remove("choicebox") s.open_tag("div", "choicebox") s.open_tag("table", "choicelist") for number, option in enumerate(self.present_options, start=1): s.open_tag("tr") s.open_tag("td", "choiceopt") self.place_link_to_command(str(number), option.menu_text) s.close_tag() s.close_tag() s.close_tag() s.close_tag() s.scroll_to_end() def run_cleanup(self) -> None: """`To run cleanup` (sourceCode.txt:6221): forget what the last perfume set up. Its last step takes "[pop uniquelist]" out of the memories once the unique memories run out; the memories never hold that entry in this release, so there's nothing to do. """ self.state.cleanup() self.try_counter = 0 # -- The ending ------------------------------------------------------------------------------------------------ async def endgame(self) -> None: """`To endgame` (sourceCode.txt:2104): every scent kept and what it stood for, then, after a key, the closing links fade in.""" s = self.screen s.clear("maintext") s.open_tag("table", "lastlist") for symbol in self.symbols: s.open_tag("tr") s.open_tag("td") s.image(symbol.iconic, "scent icon") s.close_tag() s.open_tag("td") self.print(f"{symbol.note} for {symbol.meaning}") self.line_break() s.close_tag() s.close_tag() s.close_tag() if self.play_mode == STANDARD: self.say( "[br]Not a scent that you could construct in a bottle. And not the only version of your past. But " "you feel the shape of it, and it's what you choose for now." ) if self.play_mode == REFLECTIVE: self.say("[br]Which is only one way of considering it; but it's what worked for tonight.") s.open_tag("table", "finoptions") s.open_tag("tr") s.open_tag("td", "thicc") self.place_link_to_command("about", "credits") s.close_tag() s.open_tag("td", "thicc") self.place_link_to_command("endnote", "endnotes") s.close_tag() s.open_tag("td", "thicc") self.place_link_to_web_site("source.html", "source code") s.close_tag() s.open_tag("td", "thicc") self.place_link_to_web_site("./", "restart", same_window=True) # the release's index.html s.close_tag() s.close_tag() s.close_tag() await s.wait_for_key() s.add_class("finoptions", "fadein")