Init Pipeline - Monika-After-Story/MonikaModDev GitHub Wiki

UPDATE:

I will not be updating this anymore. There are too many changes to track. I will instead write a script to retrieve functions based on init level, but thats about it.

This page will be explanation of all the init levels we use in MAS, which should act as a helpful timeline of startup events. NOTE: While we previously listed functions/vars/constants/imports, we will no longer list those. Every init event will continue to be listed, but only summary information will be given instead of specifics. (If applicable)

Init levels go from -999 -> 999. It is possible to use levels lower or higher than the limits, but renpy advises not to. Python early is even before -999, and happens before persistent is loaded.

In general:

  1. Event framework created in early.
  2. Logging can be done after -990. Data verification functions can be used after -990.
  3. persistents are backed up at -900. persistents are also cleaned of useless data.
  4. Time travel is detected at -890.
  5. Data migration can happen at -897.
  6. Data verification occurs at -895.
  7. Bad update files from a failed update are cleaned at -894.
  8. DelayedActions can be built after -880.
  9. Pre-adding DelayedActions can happen after -880.
  10. DelayedAction creation functions need to be defined before -875
  11. Historical data saving happens at -800.
  12. The lock db can be used after -500.
  13. Docking Station can be used after -45.
  14. Affection's numerical value can be loaded after -10.
  15. Monika images can be built after -5.
  16. Databases are mapped to codes and yearsets are cleaned at 4.
  17. All topics are created at 5.
  18. EV functions can be used after 6.
  19. Update migration mapping is setup at 9.
  20. Update scripts run at 10.
  21. Affection functions can be used after 20.
  22. JSON-based sprites are loaded at 190.
  23. Selectable data is loaded from persistent at 200.
  24. Images are built at 500.
  25. Overlays can be hidden/shown/enabled/disabled after 501.
  26. Piano JSONS are loaded at 800.
  27. DelayedAction runtime map is loaded at 994.
  28. Init-stage DelayedActions are run at 995.
  29. Late update scripts are run at 999.

QUICKLINKS

levels


Now for the actual init levels.

early

top

global (definitions)

The Event, MASButtonDisplayable, MASQuipList and MASMailbox classes are defined here. Also basically the Event framework.

imports

  • singleton
  • datetime

constants

  • MAS_MONIKA_Z - zorder for monika display
  • MAS_BACKGROUND_Z - zorder for bg display
  • EV_ACT* - EV action constants + list of those constants

classes

  • Event - core class that represents basically every topic
  • MASButtonDisplayable - core displayable that can act as a button in custom displayables
  • MASQuipList - quip manager class for easy quip management. Not used often, but can do random label launching nicely
  • MASMailbox - async communication helper for comms between objects. Users should extend this rather than use directly.
  • MASLinearForm - class to represent linear functions. used in clickzones
  • MASEdge - class to represent an line with 2 points (edge). used in clickzones
  • MASClickZone - polygon zone that react if clicked in. Capable of using an arbitrary list of verticies.
  • MASInteractable - base class for all interactble displayables that use clickzones

mas_ev_data_ver (event-handler)

Declares all verification functions

imports

  • __builtin__
  • datetime

global (event-handler)

Flowcheck (FC) constants are defined here

constants

  • MAS_FC_* - flowcheck constants and list of them for DelayedAction framework

global (zz_backup)

Does persistent checks and disables backup system if necessary.

-999

top

global (definitions)

sets not_finite_loop checking to 120 seconds instead of 60. Also creates the log folder if it doesn't exist.

imports

  • os

_mas_dm_dm (zz_dm)

Contains all functions as well as the current data version for data migrations. All data migration functions should be here.

imports

  • store

-990

top

mas_utils (definitions)

Core utility functions are defined here

imports

  • store
  • os
  • stat
  • shutil
  • datetime
  • codecs
  • platform
  • time
  • expanduser from os.path
  • LogFile from renpy.log

functions

  • clean_gui_text - cleans gui text by removing key symbols
  • copyfile - copies files from one location to another
  • getMASLog - gets the appropriate log file to use for logging
  • logrotate - does a log rotation for a given log
  • pdget - Protected Dict GET. gets an item from a dict with protections for Nones and such
  • trydel - attempts to delete a file at a path
  • tryparsedt - attempts to parse a string into a datetime
  • tryparseint - attempts to parse a value into an int
  • trywrite - attempts to write a file
  • writelog - writes messages to mas log

-985

top

global (definitions)

Various important global functions

functions

  • mas_getAbsenceLength - gets time difference between current session start and the last session end. always returns a datetime.timedelta
  • mas_getCurrSeshStart - gets the current session start. always returns a datetime.datetime
  • mas_getFirstSesh - gets the first session datetime. always returns a datetime.datetime
  • mas_getLastSeshEnd - gest the last session end. always returns a datetime.datetime
  • mas_getSessionLength - gets length of the current session. always returns a datetime.timedelta
  • mas_isFirstSeshPast - checks if first session is past a given date
  • mas_TTDetected - checks if time travel was detected

-950

top

mas_ev_data_ver (event-handler)

Declares curried verify objects

imports

  • store

-900

top

mas_affection (script-affection)

Affection constants and core functions

constants

  • BROKEN - broken aff state
  • DISTRESSED - distressed aff state
  • UPSET - upset aff state
  • NORMAL - normal aff state
  • HAPPY - happy aff state
  • AFFECTIONATE - aff aff state
  • ENAMORED - enamored aff state
  • LOVE - love aff state
  • _aff_order - affection states in the "natural order" of affection, from lowest to highest
  • _aff_level_map - map of affection states, used in validations.
  • _aff_cascade_map - affection states in a map that routes an affection state to the next state closest to NORMAL
  • _affg_order - affection group states in the "natural order" of affection, from lowest to highest
  • _affg_cascade_map - affection group states in a map that routes an affection group to the next group state cloest to G_NORMAL

global (script-holidays)

Deletes christmas.rpy and rpyc.

global (zz_backup)

Runs the persistent backup system. All code here is not intended for runtime usage.

imports

  • os
  • mas_utils

mas_ics (zz_dockingstation)

Initializes image checksums and file maps for decoding images at runtime

imports

  • os

-897

top

global (zz_dm)

Data migration that happens after backup. Data versions should be set

-895

top

mas_ev_data_ver (event-handler)

Verifies persistent event data

-894

top

global (updater)

cleans bad update files

-890

top

mas_globals (script-ch30)

time travel is detected

imports

  • datetime
  • store

vars

  • tt_detected - True if time travel was detected. This is limited to checking if we went back in time.

-880

top

global (event-handler)

Sets up the MASDelayedAction framework core.

vars

  • persistent._mas_delayed_action_list - static list of MASDelayedAction ids. initialized if None
  • mas_delayed_action_map - runtime map of MASDelayedActions

classes

  • MASDelayedAction - class used for the DelayedAction framework

functions

  • mas_removeDelayedAction - functions used for removing/dequeing DelayedActions
  • mas_runDelayedAction - attempts to run DelayedActions
  • mas_addDelayedAction - functions used for adding/queueing DelayedActions

mas_delact (event-handler)

Declares a special function for adding MASDelayedAction ids early in the pipeline.

imports

  • store

functions

  • _MDA_safeadd - special function for early adding of MASDelayedAction. Normal users should use the approved add/remove functions instead of this.
  • _MDA_saferm - special function for early removing of MASDelayedAction. Normal users should use the approved add/remove functions instead of this.

-876

top

In general, all MASDelayedAction constructor functions are built here.

mas_delact (script-greetings)

Contains MASDelayedAction constructor functions for greetings

mas_delact (script-holidays)

Contains MASDelayedAction constructor functions for holiday events

mas_delact (script-islands-event)

Contains MASDelayedAction constructor functions for the islands event

mas_delact (script-story-events)

Contains MASDelayedAction constructor functions for the bday events. Also contains the action callables for those MASDelayedActions.

-875

top

mas_delact (event-handler)

Contains a map mapping MASDelayedAction creation functions to IDs. Because of this, all MASDelayedAction creation functions need to be created before this init level.

imports

  • datetime

-860

top

mas_history (zz_history)

Declares main history saver functions and constants, as well as some persistents

imports

  • store
  • datetime

constants

  • L_FOUND - found data in the archives
  • L_NO_YEAR - did not find year in the archives
  • L_NO_KEY - did not find key in the archives

functions

  • addMHS - adds a MASHistorySaver object to the database.
  • getMHS - retrieves a MASHistorySaver object based on ID

-850

top

global (zz_history)

Declares public history saver functions and the main class

classes

  • MASHistorySaver - history saving object that automates data migration as well as other things

functions

  • mas_HistLookup - looks up data in the archives
  • mas_HistLookup_k - key-centric version of mas_HistLookup
  • mas_HistLookup_ot - looks up data in the archives, over multiple years
  • mas_HistLookup_otl - looks up data in the archives, given a list of years
  • mas_HistLookup_otl_k - key-centric version of mas_HistLookup_otl
  • mas_HistVerify - checks if some data matches what was stored in the archives at one point. (checks multiple years)
  • mas_HistVerify_k - key-centric version of mas_HistVerify

-816

top

MASDelayedAction callbacks can be defined here, but it's better to define them closer to where they are needed.

-815

top

mas_history (script-holidays)

Where programming points for MASHistorySaver objects for holidays are defined.

mas_history (zz_history)

Where programming points for MASHistorySaver objects can be defined.

imports

  • _MDA_safeadd, _MDA_saferm from mas_delact

-810

top

Most MASHistorySaver objects are created here.

global (script-holidays)

Creates the MASHistorySaver object for o31, d25, nye, player bday, f14

global (zz_history)

Creates the MASHistorySaver object for player model variables and bday.

-800

top

mas_history (zz_history)

Runs the MASHistorySaver algorithm.

-750

top

mas_threading (zz_threading)

Declares the MASAsyncWrapper class

imports

  • threading

classes

  • MASAsyncWrapper - class that does nicely abstracted multithreading / async functions

-600

top

mas_delact (event-handler)

imports

  • store

-500

top

global (event-handler)

Initializes the LOCK DB portion of the Event framework.

vars

  • mas_init_lockdb_template - lockdb template (designed to be modified when adding properties)
  • persistent._mas_event_init_lockdb - actual database for lock data. Initialized if None
  • persistent._mas_event_init_lockdb_template - stored lockdb template (used to check if properties have been added to the Event framework)
  • Event.INIT_LOCKDB - sets this to the lock database

mas_dockstat (zz_dockingstation)

initializes key dockstat constants

constants

  • blocksize - irl blocksize we should be using for any file I/O
  • b64_blocksize - irl blocksize we should be using for file I/O with base64 encoded files
  • MAS_PKG_* - monika status constants
  • MAS_SBD_* - monika surprise party constants

-150

top

mas_selspr (zz_selector)

Selector rules should be defined here

-101

top

mas_sprites (sprite-chart)

ACSTemplates are defined here

-100

top

mas_utils (definitions)

Initializes utility functions, mainly ones not needed super early

imports

  • datetime
  • ctypes
  • random
  • cStringIO.StringIO

functions

  • add_years - date adjusting function
  • add_months - date adjusting function
  • am3 - takes a datetime object and returns it with time set to 3am
  • log_entry - logs historical entries into the given log
  • mdnt - takes a datetime object and returns it with time set to midnight
  • normalize_points - normalizes a list of points with offsets
  • sod - takes a datetime object and returns it with time set to the "start of day"
  • randomblob - generates a random blob of data in a StringIO buffer
  • tryparsefloat - attempts parsing a value into a float

global (splash)

checks if the DDLC archives are in the game folder.

mas_selspr (zz_selector)

sets up prompt map

imports

  • store
  • mas_utils

functions

  • get_prompt - gets prompt for a selector topic via key
  • in_prompt_map - checks if a prompt selector exists for a key
  • set_propmt - sets prompt for a selector topic via key

-45

top

global (zz_dockingstation)

Initializes the DockingStation framework.

imports

  • os

vars

  • mas_docking_station - instance of MASDockingStation, centered around the characters folder

classes

  • MASDockingStation - class designed for easy base64 file i/o + checksums. (think giving files and taking monika out)

-21

top

mas_sprites_json (zz_sprites_json)

Defines key constants and maps for JSON-based sprites

-20

top

mas_background (zz_backgrounds)

declares key MASBackground loading/saving functions. NOTE: MASBackground is foolishly declared later in the pipline so do not call anything in here until after -10.

global (zz_selector)

Declares selectable classes.

classes

  • MASSelectableAccessory - Selectable class for accessories
  • MASSelectableHair - Selectable class for hair
  • MASSelectableClothes - Selectable class for clothes

mas_weather (zz_weather)

Important weather data + weather programming points

imports

  • random
  • datetime
  • store

constants

  • WEATHER_MAP - database of weather objects

functions

  • loadMWData - loads weather data from persistent
  • saveMWData - saves weather data to persistentnt
  • unlockedWeathers - returns number of unlocked weather items
  • weatherProgress - changes weather for progressive weather if appropriate

-11

top

mas_o31_event (script-holidays)

Sets up the o31 event vars and image decoder

imports

  • store
  • mas_dockstat
  • mas_ics

vars

  • o31_cg_station - MASDockingStation instance centered around the o31 cg folder
  • o31_cg_decoded - True if we decoded the cg, False otherwise
  • mas_return_from_tt - True if we just returned from the Trick/Treat farewell

functions

  • decodeImage - decodes a specific cg image
  • removeImages - removes all cg images
  • isMonikaInCostume - True if monika is in costume, False otherwise
  • isTTGreeting - True if we have a greeting type associated with a Trick/Treat farewell
  • spentO31 - True if user spent o31 with the player, False if not

global (script-holidays)

1 function

functions

  • mas_player_bday_curr - sets date of current year bday, accounting for leap year

mas_player_bday_event (script-holidays)

Image functions

functions

  • show_player_bday_Visuals - shows player bday visuals
  • hide_player_bday_Visuals - hides player bday visuals

mas_island_event (script-islands-event)

Sets up the island event image decoder function

imports

  • store
  • mas_dockstat
  • mas_ics

vars

  • islands_station - MASDockingStation instance centered around the islands folder

functions

  • decodeImages - decodes island images
  • removeImages - removes island images

mas_dockstat (zz_dockingstation)

sets up image decoder functions

imports

  • mas_utils

functions

  • decodeImages - generic image decoder
  • removeImages - generic image remover

mas_filereacts (zz_reactions)

Sets up the file reactions framework

imports

  • store
  • mas_utils
  • datetime
  • random

vars

  • filereact_db - File reaction Event database
  • filereact_map - mapping filenames to file reaction events.
  • foundreact_map - volitaile map containing reactable filenames to on disk filenames.
  • th_foundreact_map - threaded variant of foundreact_map
  • connectors - MASQuipList of connectors for file reactions
  • gift_connectors - MASQuipList of gift connectors for file reactions

functions

  • addReaction - adds a file reaction (this is internalized, there is a global variant)

-10

top

All Date-related functions should be init'd here. Please move them here if not already done so.

global (script-affection)

Declares affection loading/saving functions.

mas_apology (script-apologies)

Apology database is initialized here

global (script-ch30)

Initializtion of mas_idle_mailbox (the idle mailbox)

vars

  • mas_idle_mailbox - the idle mailbox

mas_fun_facts (script-fun-facts)

fun-fact database and types

global (script-holidays)

Date checking functions for holidays

functions

  • mas_isO31 - determines if the given date is o31
  • mas_isD25 - determines if given date is d25
  • mas_isD25Eve - determines if given date is d25 eve
  • mas_isD25Season - determines if given date is in d25 season
  • mas_isD25Post - determines if given date is in d25 season but after d25
  • mas_isD25PreNYE - determines if given date is in d25 season but before nye
  • mas_isD25PostNYD - determines if given date is in d25 season but after nyd
  • mas_isD25Gift - determines if given date is in range of days where gifts can be considered d25 gifts
  • mas_isD25Outfit - determines if given date is in range of days where Monika wears the santa outfit
  • mas_isNYE - determines if given date is nye
  • mas_isNYD - determines if given date is nyd
  • mas_isplayer_bday - determines if given date is player birthday
  • mas_isF14 - determines if given date is f14

global (script-islands-event)

Decodes images.

vars

  • mas_cannot_decode_images - True if we failed to decode the images, False otherwise

mas_songs (script-songs)

song database defined hre

global (updates)

sets up some flags used by the updater. these things are mostly legacy for updating from super old versions.

vars

  • found_monik_ani - True means persistent.monika_anniversary is set. super old
  • no_topics_list - True means we dont have the old random topics list. not really important anymore.

global (zz_backgrounds)

Defines the MASBackground class

mas_calendar (zz_calendar)

calendar constants

constants

  • CAL_TYPE_* - calendar Event types

mas_hotkeys (zz_hotkeys)

state vars for enabling certain functions

vars

  • allow_dismiss - True enables dismissing, False disables

functions

  • allowdismiss - returns state of allow_dismiss

mas_interactions (zz_interactions)

Key functions and constants for interactables

mas_selspr (zz_selector)

Declares selection screen constants and functions, and the selectable mailbox class. Also generic selector dialgoue

global (zz_transforms)

only one thing. the image existence checker

functions

  • getCharacterImage - retrieves the Displayable of a character + expression

mas_windowreacts (zz_windowreacts)

initial vars and database

vars

  • can_show_notifs - True if we can show notifs, False if we cannot

-9

top

global (zz_interactions)

MASBoopInteractable defined here, but unused.

-5

top

mas_sprites (sprite-chart)

Declares all the functions and constants used for DynamicDisplayable creation

constants

NOTE: There are lots of constants here. Only including the ones that might need to be changed often.

  • POSES - list of non-leaning poses
  • L_POSES - list of leaning poses
  • SP_ACS - sprite code for ACS (pulled from sprite jsons)
  • SP_HAIR - sprite code for HAIR (pulled from sprite jsons)
  • SP_CLOTHES - sprite code for CLOTHES (pulled from sprite jsons)
  • EXPROP_TOPIC_MAP - maps an exprop to list of related topics
  • ACSTYPE_TOPIC_MAP - maps asc type to its selector topic

vars

  • lean_acs_blacklist - list of accessories that should disable leaning

functions

NOTE: there are lots of image generation functions here. Only including functions that might be used outside of here.

  • init_acs - initializes an accessory for later use. required for all accessories
  • init_hair - initalizes a hairstyle for later use. required for all hairstyles
  • init_clothes_ - initializes clothes for later use. required for all clothes
  • tryparsehair - checks if the given hair string exists
  • tryparseclothes - checks if the given clothes string exists
  • rm_acs - removes an acs from the map
  • lock_exprop_topics - locks topics related to an exprop
  • lock_acstype_topics - locks topics related to an acs type
  • unlock_exprop_topics - unlocks topics related to an exprop
  • unlock_acstype_topics - unlocks topics related to an acs type
  • get_sprite - returns sprite object given sprite name and sprite type

-4

top

global (zz_poemgame)

initializes some poemgame classes and functions

classes

  • MASPoemWord - version of PoemWord that includes Monika
  • MASPoemWordList - encapsulates MASPoemWords into a list

functions

  • glitchWord - glitches the given text with odds for space / unicode. better to use giltchtext for fully glitched text.

-3

top

mas_piano_keys (zz_pianokeys)

initializes lots of backing framework for the piano game + menus

imports

  • pygame
  • os

constants

NOTE: contains a huge amount of constants. None are really useful outside of piano. Only going to mention somewhat important ones here.

  • NOTE_SIZE - controls how many notes are played before we try matching when not in SONG_MODE

vars

  • log - log purely for piano keys. Dont use unless its piano related.
  • pnml_db - PianoNoteMatchList main database. Used to show what songs can be played
  • pnml_bk_db - PianoNoteMatchList backup database. Used for song matching in freestyle.

classes

  • PianoNoteMatch - represents a note phrase + lyrics in piano
  • PianoNoteMatchList - represents a list of PianoNoteMatches (aka a song) in piano

functions

NOTE: contains a huge amount of functions needed for JSON converting. None are useful outside of piano.

-2

top

mas_anni (script-anniversary)

Declares helper anniversary build functions NOTE: contains a pointer copy to persistent

imports

  • evhand
  • mas_calendar
  • mas_utils
  • datetime

functions

  • build_anni - builds an anniversary date using the first_session datetime and the given advancers
  • build_anni_end - same as build_anni, except gets the ending datetime of an anniversary
  • isAnni - checks if the today is an anniversary, using the given milestone
  • isAnniWeek - checks if today is a 1 week anniversary
  • isAnniOneMonth - checks if today is a 1 month anni
  • isAnniThreeMonth - checks if today is a 3 month anni
  • isAnniSixMonth - checks if today is a 6 month anni
  • isAnniAny - checks if today is any anni
  • anniCount - returns how many years the player has been with monika
  • pastOneWeek - True if player has been with monika for at least 1 week
  • pastOneMonth - True if player has been with monika for at least 1 month
  • pastThreeMonths - True if player has been with monika for at least 3 months
  • pastSixMonths - True if player has been with monika for at least six months

mas_topics (script-topics)

Initializes topic-related constants and helper functions

constants

  • S_MOST_SEEN - percentage of seen topics. used in calculations for dividing topics into the seen groups. think of this as a percentage of the collection.
  • S_TOP_SEEN - percentage of seen topics considered to be the most often seen. used in calculations for dividing topics into seen groups. think of this as an upper percentile.
  • S_TOP_LIMIT - if the percentage of topics that fall under S_TOP_SEEN percentile is greater than this amount, then we use the S_MOST_SEEN percentage in dividing topics into seen groups.
  • UNSEEN - chance out of 100 that we select an unseen topic
  • SEEN - chance out of 100 that we select an already seen topic
  • MOST_SEEN - chance out of 100 that we select a topic that has is considered over-seen

global (sprite-chart)

Initializes MASMonika character object for hair/clothing/acs framework

imports

  • math
  • namedtuple (UNUSED)

classes

  • MASMonika - represents Monika's clothes and hair and accessories
  • MASPoseMap - helper class for mapping poses to images.
  • MASSpriteBase - base class for all object-represented sprite sets
  • MASSpriteFallbackBase - base class for all object-represented sprite sets that can use MASPoseMap as a fallback system
  • MASAccessory - class representation of an accessory
  • MASHair - class representation of a hairstyle
  • MASClothes - class representation of clothes

functions

  • mas_drawmonika - drawing function used for DynamicDisplayables

mas_sprites (sprite-chart)

Programming points for sprites

imports

  • store

mas_background (zz_backgrounds)

prog points for MASBackgrounds should be defined here

mas_poemgame_fun (zz_poemgame)

Poemgame-related functions initalized here Everything here is suitable only for the poemgame, so not going to mention them here.

mas_sprites (zz_spriteobjects)

general-use progpoints

-1

top

_mas_root (definitions)

contains very powerful functions. not for the faint of heart

imports

  • store
  • datetime

functions

  • glitchtext - copy of the existing glitchtext function. This was before I knew about store
  • mangleFile - mangles a file by messing with its bytes
  • resetPlayerData - resets persistent data. pretty dangerous
  • initialSessionData - resets session data to default

global (definitions)

basically 4 billion startup-related stuff. Mostly small things that dont go anywhere else. Also is where some base keymap stuff is set (not custom keymaps).

imports

  • datetime
  • os

functions

  • get_procs - retreives list of running processes if on windows
  • is_running - checks if a process in the given list of process names is currently running
  • is_file_present - checks if a file is present
  • mas_cvToDHM - converts miniutes into a displayable form of hour / minutes
  • mas_cvToHM - converts minutes into hour / minutes
  • mas_genDateRange - generates a list of dates within a given range (exclusive)
  • mas_isSTtoAny - checks if a time object is within a suntime amount and an hour / minute amount
  • mas_isSRtoAny - checks if a time object is within sunrise and an hour / minute amount
  • mas_isSStoAny - checks if a time object is within sunset and an hour / minute amount
  • mas_isAnytoST - checks if a time object is within an hour / minute amount and a suntime amount
  • mas_isAnytoSR - checks if a time object is within an hour / minute amount and sunrise
  • mas_isAnytoSS - checks if a time object is within an hour / minute amount and sunset
  • mas_isMNtoSR - checks if a time object is wtihin midnight to sunrise
  • mas_isSRtoN - checks if a time object is within sunrise to noon
  • mas_isNtoSS - checks if a time object is within noon to sunset
  • mas_isSStoMN - checks if a time object is within sunset to midnight
  • mas_isSunny - checks if a time object is within sunrise to sunset
  • mas_isNight - checks if a time object is not within sunrise to sunset
  • get_pos - gets position of currently playing music
  • delete_all_saves - deletes all saved games. (basically useless)
  • delete_character - deletes a character file. (basically useless)
  • pause - seems to be a variant of pause? unsure of usage
  • enumerate_steam - returns installed Steam IDs from a steam install. Untested, unused, probably buggy

evhand (event-handler)

Event menu constants and key functions. also contains some Event databases

imports

  • store
  • namedtuple
  • datetime

constants

  • LAST_SEEN_DELTA - time delta used for determining if a topic has been seen recently
  • RESTART_BLKLST - list of topics that should NOT be pushed to the event stack on a restart if they were interrupted.
  • IDLE_WHITELIST - list of labels that are allowed in idle

vars

  • event_database - Event database of main topics (random + pool)
  • farewell_database - Event database of farewells
  • greeting_database - Event database of greetings

functions

  • addIfNew - adds items to a list of they are not in there already
  • addYearsetBlacklist - adds an event label to the yearset blacklist
  • isYearsetBlacklisted - checks if an event label is yearset blacklisted
  • tuplizeEventLabelList - takes a list of keys and an Event database and returns a (prompt, label) list suitable for menu displaying
  • internalized versions of isFuture/isPresent/isPast (Event date comparison functions)
  • internalized versions of hideEvent*/lockEvent*/unlockEvent* (Easy Event hiding / locking / unlocking functions)

global (event-rules)

Initialzes static classes used for creating rule tuples for Events

imports

  • datetime
  • mas_utils

constants

  • EV_RULE_... - rule type identifiers for the rule dicts in Event objects
  • EV_NUM_... - numerical repeat rule constants + list of them

classes

  • MASNumericalRepeatRule - creates / modifies / checks numerical repeat rules. aka repeat every x days/weeks/months/year
  • MASSelectiveRepeatRule - creates / modifies / checks selective repeat rules. aka repeat when today matches this date/time criteria
  • MASGreetingRule - creates / modifies / checks greeting rules. These are for deciding random chance of a greeting and/or should skip visuals
  • MASFarewellRule - creates / modifies / checks farewell rules. These are for deciding random chance of a farewell
  • MASAffectionRule - creates / modifies/ checks affection rules. These are used to determine if farewells should be shown NOT UNLOCKED
  • MASPriorityRule - gives Events priority values. Usage may vary.
  • MASUndoActionRule - allows events to undo changes to their action property when outside a date range
  • MASStripDatesRule - clears start_date and end_date from events when outside a date range

mas_pong (pong)

Contains some label constants for pong. Nothing here would be useful outside of pong. These are mainly to help with label replacing API, but this is a bad idea for efficiency, so probably dont follow this paradigm. There is a renpy-native way of label mapping/replacing, so we should use that for api purposes.

global (screens)

layout vars for the confirm quit popup, screens, and screen styles NOTE: screens and styles here are done via init_offset rules

vars

  • layout.QUIT_YES - message shown when user hits yes to the confirm quit popup
  • layout.QUIT_NO - message shown when user hits no to the confirm quit popup

styles

NOTE: a large amount of styles. Not going to put them here.

screens

NOTE: large amount of screens here. Only going to mention the custom / important ones.

  • preferences - this is where we add custom settings
  • twopane_scrollable_menu - the double paned scrollable menu, used int he Talk menu
  • scrollable_menu - single paned scrollable menu. Not generalized, so dont use this
  • mas_gen_scrollable_menu - generalized scrollable menu. Use this
  • mas_background_timed_jump - screen used to do timed menus
  • mas_generic_restart - a very generic retart menu. forgot what this is for

classes

  • PauseDisplayable - custom Displayable that acts as a much better pause

mas_affection (script-affection)

Audit log for the affection system.

imports

  • os
  • datetime
  • mas_utils
  • store

functions

  • audit - function for affection change auditing

mas_globals (script-ch30)

Meant to initalize globals. not really used though.

vars

  • dlg_workflow - True if we are in the middle of dialogue, False otherwise
  • show_vignette - True if we should show the vignette mask everywhere, False means do not show
  • show_lightning - True if we should show lightning during idle, False means do not show
  • lightning_chance - 1 out of x chance that lightning will show during idle
  • lightning_s_chance - 1 out of x chance that the sayori lightning egg will show during idle
  • show_s_light - True if we show the sayori thunder egg, False if not
  • text_speed_enabled - True if text speed is enabled, False if not
  • in_idle_mode - True if in idle mode, False if not
  • late_farewell - True if a late farewell just happened
  • last_minute_dt - last minute calendar-related events were checked
  • last_hour - number of the hour we last ran ch30_hour
  • last_day - number of the day we last ran ch30_day
  • returned_home_this_sesh - True if this session started with a return home

mas_compliments (script-compliments)

initializes compliment menu constants, the compliment database, and compliment quips

vars

  • compliment_database - Event database of compliments
  • thanking_quips - single line quips used to thank player for compliments

mas_farewells (script-farewells)

Sets up the farewell selection function

functions

  • selectFarewell - selects the farewell to use. This does a bunch of algorithm stuff.

mas_greetings (script-greetings)

Sets up greeting types and the greeting selection function

imports

  • store.mas_ev_data_ver as mas_edv
  • store
  • datetime
  • random

constants

  • TYPE_... - greeting type constants

functions

  • selectGreeting - selects a greeting to use. This does a bunch of algorithm stuff

global (script-introduction)

Not sure why this is here.

imports

  • mas_affection

global (script-holidays)

holiday functions

mas_moods (script-moods)

mood constants / database / functions

constants

  • TYPE_* - mood types

vars

  • mood_db - Event database for moods

functions

  • getMoodType - gets the mood type for a given mood label

mas_ptod (script-python)

Creates the console for python teaching

imports

  • mas_utils

constants

NOTE: all constants in here are purely for the console. No usage outside of this store.

functions

  • clr_cn - short variation of clear console function
  • ex_cn - short variation of exit console function
  • rst_cn - short variation of restart console function
  • w_cmd - short variation of write command function
  • x_cmd - short variation of execute command function
  • wx_cmd - does both writing and executing of a command
  • write_command - writes a command to the console. Does NOT execute
  • clear_console - clears the console history and the current line
  • restart_console - clears console history, current line, also displays the version text
  • exit_console - disables the console
  • exec_command - executes the currently written command. like pressing Enter
  • get_last_line - gets last line from console history

mas_stories (script-stories)

story constants and database

imports

  • store

vars

  • story_database - Event database of stories

global (script-topics)

functions core to the topic selection algorithm. Also seeds random.

imports

  • random
  • songs
  • evhand

functions

  • remove_seen_labels - removes labels that have already been seen from the given list
  • mas_randomSelectAndRemove - randomly selects an element from the given list and removes it from the list
  • mas_randomSelectAndPush - like mas_randomSelectAndRemove, but also pushes the event to the stack
  • mas_insertSort - insertion sort an item into a list
  • mas_splitSeenEvents - splits a list of seen events into seen and most seen
  • mas_splitRandomEvents - splits dict of events into seen and unseen
  • mas_buildEventLists - builds the unseen / seen / most seen event lists
  • mas_buildSeenEventLists - builds the seen / most seen event lists
  • mas_rebuildEventLists - rebuilds the unseen / seen / most seen event lists

global (updater)

Creates the custom displayable updater screen

classes

  • MASUpdaterDisplayable - custom displayable that does better update checking than the stock update check screen

global (updates_topics)

one function

functions

  • clearUpdateStructs - deletes update data to save space

global (zz_backgrounds)

the default spaceroom is defined as a MASBackground here.

global (zz_calendar)

Initializes calendar displayable

imports

  • json

classes

  • MASCalendar - displayable that allows for a selectable calendar or a viewing calendar

mas_calendar (zz_calendar)

Calendar database and functions for it

imports

  • datetime
  • json
  • renpy

vars

  • calendar_database - complicated dict of dicts for storing calendar events. See the code for more info.

functions

  • genFriendlyDispDate - creates display friendly date/time from a datetime (its a bit more complicated than that though)
  • save/loadCalendarDatabase - saving and loading
  • addEvent* - functions for adding Events to the calendar
  • addRepeatable* - functions for adding Repeatables to the calendar
  • removeEvent* - functions for removing Events from the calendar
  • removeRepeatable* - functions for removing Repeatables from the calendar

global (zz_graphicsmenu)

creates the custom graphics menu displayable

classes

MASGraphicsMenu - custom displayable for changing the render

mas_hangman (zz_hangman)

initializes some hangman constants

imports

  • store
  • copy
  • random

constants

  • MONI_WORDS - list of monika's words
  • EASY_MODE - constant for easy hangman mode
  • NORM_MODE - constant for normal hangman mode
  • HARD_MODE - constant for hard hangman mode

vars

  • hm_words - dict of current selectable words by difficulty
  • all_hm_words - dict of all hangman words by difficulty

hkb_button (zz_hotkey_buttons)

state vars for button enabling

vars

  • talk_enabled - True enables talk button, False disables
  • music_enabled - True enables music button, False disables
  • play_enabled - True enables play button, False disables
  • movie_buttons_enabled - True enables play button, False disables (unused)

mas_hotkeys (zz_hotkeys)

state vars for hotkey enabling

vars

  • talk_enabled - True enables talk hotkey, False disables
  • music_enabled - True enables music hotkey, False disables
  • play_enabled - True enables play hotkey, False disables
  • derandom_enabled - True enables derandoming, False disables
  • bookmark_enabled - True enables bookmarking, False disables
  • mu_stop_enabled - True enables music volume lowering / stopping hotkeys, False disables
  • no_window_hiding - True disables window hiding, False enables

songs (zz_music_selector)

sets up music functions and the music menu

imports

  • os
  • mutagen.mp3
  • mutagen.oggopus
  • mutagen.oggvorbis

constants

NOTE: all song names and filepaths are constants here (official songs, not custom songs)

  • PAGE_LIMIT - number of songs per page

vars

  • current_track - currently playing song
  • selected_track - last selected track
  • menu_open - True if the music menu is open, False otherwise
  • music_choices - contains the music list
  • music_pages - paginated music list

functions

  • adjustVolume - adjusts volume of an audio channel
  • getVolume - gets volume of an audio channel
  • getPlayingMusicName - gets the name of the currently playing song
  • initMusicChoices - initializes the music menu
  • isInMusicList - checks if a song is int he music menu list

global (zz_selector)

Declares displayable for selectables

imports

  • random

classes

  • MASSelectableImageButtonDisplayable - displayable for an image button that is associated with selectable.

functions

  • mas_filterUnlockGroup - unlocks a selector for a group if it passes certain criteria

global (zz_sprite_objects)

initializes MASAccessory, MASHair, and MASClothes objects

global (zz_weather)

Weather objects are declared here. We also load weather data.

0

top

This is considered the default init level when no number is provided. Additionally this init level covers:

  • default statements
  • define statements
  • screens (unless changed by init offset)
  • labels (unless changed by init offset)
  • styles (unless changed by init offset)
  • transforms (unless changed by init offset)

mas_chess (chess)

inits chess constants. None are useful outside of here.

global (definitions)

inits a ton of stuff. Not going to list them here since there's just too many

functions (key ones)

NOTE: we should move these out of here. init 0 should be avoided for all functions.

  • mas_passedILY
  • mas_ILY - sets ILY vars
  • mas_shouldKiss

config (definitions)

inits some config vars

audio (definitions)

all stock audio is defined here. Rain is added to this store as well.

mas_suntime (definitions)

suntime-related constants and vars are defined here

times (definitions)

times used in idle exp calcs

xp (definitions)

constants for amount of XP gained for things

global (event-handler)

inits import Event related functions

imports

  • evhand
  • datetime

functions

  • addEvent - adds an Event object to an Event database. Core function used for every Event init.
  • mas_hideEvent - locks/derandoms/depools/deconditionals an event
  • mas_hideEventLabel - same as above but for an event label
  • mas_showEvent - unlocks/randoms/pools an event
  • mas_showEventLabel - same as above but for an event label
  • mas_lockEvent - locks an event
  • mas_lockEventLabel - same as above but for an event label
  • mas_unlockEvent - unlocks an event
  • mas_unlockEventLabel - same as bove but for an event label
  • global versions of isFuture/isPresent/isPast functions
  • pushEvent - push an Event to the Event stack
  • queueEvent - queues an Event to the Event stack
  • popEvent - pops the next Event from the stack.
  • seen_event - checks if an Event has been seen or is currently in the Event stack
  • restartEvent - pushes an interuppted Event back onto the Event stack if its not in the blacklist
  • mas_isRstBlk - checks if the given label is part of the blacklist
  • mas_cleanJustSeen* - functions for cleaning an Event list of things that were seen recently
  • mas_unlockPrompt - attempts to unlock a Pool Event
  • mas_findEVL - gets index of an eventlabel in the event list
  • mas_inEVL - checks if an eventlabel is in the event list
  • mas_rmEVL - removes an event label from the event list
  • mas_rmallEVL - removes all occurrences of an event label from event list

global (import_ddlc)

1 function lol

functions

  • dumpPersistentToFile - does what it says

config (options)

key configuration vars

gui (options)

key gui vars

build (options)

build settings

preferences (options)

key preferences

global (pong)

pong's displayable as well as other pong-stuff

imports

  • random
  • math

classes

  • PongDisplayable - displayable that runs pong

global (progression)

key functions for xp system

functions

  • grant_xp - give some experience
  • get_level - returns the user's current level

global (screens)

a couple of functions

functions

  • RigMouse - aka the mouse movement glitch
  • FinishEnterName
  • FileActionMod - shows that save dialogue thing

mas_layout (screens)

Inits constants for layout adjustments, and some helper functions for them too

imports

  • store
  • mas_affection

constants

NOTE: this makes a ton of constants, only going to mention important ones here

  • QUIT_MAP - mapping of affection levels to what their QUIT messages should be

global (script-affection)

affection state vars, the final farewell displayable, surprise text code

vars

  • mas_curr_affection - current affection state
  • mas_curr_affection_group - current affection state group

classes

  • MASFinalNoteDisplayable - displayable for the final farewell poem

global (script-apology)

just apology related functions

functions

  • mas_checkApologies - checks apologies and removes old ones

global (script-ch30)

Very wide variety of things. Kind of like definitions 2. Also retrieves currentuser, checks playername vars, checks for battery support, registers the background audio channel. Only going to mention some of the stuff here.

imports

  • subprocess
  • os
  • eliza
  • datetime
  • battery
  • re
  • songs
  • hkb_button
  • mas_globals

vars

  • morning_flag - True if it's currently morning, False if not. this is more like a previous state var.

functions

  • show_dialogue_box - jumps to the talk menu
  • pick_game - jumps to Play menu
  • mas_enable_quitbox - enables monika's quit dialogue warning
  • mas_disable_quitbox - disables monika's quit dialogue warning
  • mas_enable_quit - enables quitting without monika knowing
  • mas_disable_quit - disables quitting without monika knowing
  • mas_drawSpaceroomMasks - draws the approrpriate window masks
  • show_calendar - shows the calendar. this is the callback for clicking the calendar button
  • slow_dismiss - callback for when Monika talks
  • mas_isMorning - checks if it's currently morning
  • mas_shouldRain - checks if it should rain based on current affection
  • mas_forceRain - forces rain art, sounds, and locks rain topics
  • mas_lockHair - locks hair topics
  • mas_resetIdleMode - resets idle mode vars
  • mas_enableTextSpeed - enables text speed
  • mas_disableTextSpeed - disables text speed
  • mas_resetTextSpeed - enables or disables text speed depending on environment vars
  • mas_isTextSpeedEnabled - returns True if text speed is enabled, False if not
  • mas_isGameUnlocked - checks if given game is unlocked
  • mas_unlockGame - unlocks the given game
  • mas_shouldChangeTime - checks if we should change to day or night
  • mas_check_player_derand - checks saved derandom prefs and derandoms those topics

gmr (script-greetings)

Stuff related to the Listen option in the opendoor greeting

vars

  • eardoor - list of unseen (or all) Listen options
  • eardoor_all - list of all the Listen options

opendoor (script-greetings)

Stuff related to the opendoor greeting

constants

  • MAX_DOOR - I dont remember what this is for
  • chance - 1 out of x chance this greeting will appear

global (script-topics)

bookmark and derandom functions

functions

  • mas_derandom_topic - derandoms a topic
  • mas_bookmark_topic - bookmarks a topic
  • mas_hasBookmarks - checks if we have bookmarked topics

global (shake)

We dont use this

global (splash)

Splash messages are defined here

global (sprite-chart)

All of Monika's images are defined here

mas_coffee (sprite-chart)

Coffee-related vars are defined here

mas_updater (updater)

inits a ton of updater related stuff

constants

  • regular - update link
  • unstable - unstable link
  • timeout - timeout for update checking

vars

  • force - set to True to force an update check

functions

  • checkUpdate - checks for an update using Renpy's update checker

global (updates)

functions related to update script migrations

functions

  • removeTopicID - unsees a topic if it has been seen
  • mas_eraseTopic - removes an Event from its persistent database and lock db
  • mas_transferTopic - transfers an Event's data and lock db data to another Event
  • mas_transferTopicSeen - transfers an Event's seen data to another Event
  • adjustTopicIDs - removes / transfers an Event's seen status
  • updateTopicIDs - updates a dict of Event's seen statuses
  • updateGameFrom - runs update scripts in the proper order

updates (updates_topics)

mapping system for update script migrations

vars

  • version_updates - dict that maps a version to its next update version
  • topics - dict that maps a version to the topic adjustments it requires

global (zz_calendar)

declares some runtime functions, adds Repeatables to the calendar.

imports

  • mas_calendar

functions

  • mas_calDropOverlayShield - enables input for the calendar overlay
  • mas_calHideOverlay - hides the calendar overlay
  • mas_calIsVisible_ovl - checks if the calendar overlay is visible
  • mas_calRaiseOverlayShield - disables input for the calendar overlay
  • mas_calShowOverlay - shows the calendar overlay, if not already showing

mas_dockstat (zz_dockingstation)

not core, but still important functions

imports

  • store
  • cPickle

functions

  • setMoniSize - does some calculating to figure out the appropriate Monika filesize

global (zz_hotkeys)

basically all the hotkey-related functions are here. I'm only listing the public ones.

functions

  • mas_HKRaiseShield - disables the t/m/p hotkeys
  • mas_HKDropShield - enables the t/m/p hotkeys
  • mas_HKIsEnabled - checks if the t/m/p hotkeys are enabled
  • mas_HKCanQuietMusic - checks if we can lower or stop the music
  • enable_esc - enables the game menu / escape key (via quick_menu)
  • disable_esc - disables the game menu / escape key (via quick_menu)
  • set_keymaps - inits the keymaps

global (zz_hotkey_buttons)

inits runtime hotkey button functions, as well as shows the buttons

functions

  • HKBHideButtons - hides the buttons
  • HKBShowButtons - shows the buttons
  • mas_HKBRaiseShield - disables the buttons
  • mas_HKBDropShield - enables the buttons
  • mas_HKBIsEnabled - checks if the buttons are enabled
  • mas_HKBIsVisible - checks if the buttons are visible
  • MovieOverlayHideButtons - hides movie buttons
  • MovieOverlayShowButtons - shows movie buttons

global (zz_music_selector)

declars music-related functions

imports

  • songs

functions

  • dec_musicvol - decreases music channel volume
  • inc_musicvol - increases music channel volume
  • mute_music - mutes music channel
  • play_song - plays a song onto the music channel
  • mas_startup_song - starts playing the persistent.current_track
  • select_music - runs the music selection menu

mas_poems (zz_poems)

defines poems database

global (zz_shields)

defines shield functions

functions

  • mas_DropShield_core - enables core interactions
  • mas_RaiseShield_core - disables core interactions
  • mas_DropShield_dlg - enables dialogue-breaking interactions
  • mas_RaiseShield_dlg - disables dialogue-breaking interactions
  • mas_DropShield_mumu - enables music-menu-breaking interactions
  • mas_RaiseShield_mumu - disables music-menu-breaking interactions
  • mas_DropShield_idle - enables idle-breaking interactions
  • mas_RaiseShield_idle - disables idle-breaking interactions
  • mas_MUMUDropShield - enables the music menu
  • mas_MUMURaiseShield - disables the music menu
  • mas_dlgToIdleShield - transitions between dlg and idle mode
  • mas_coreToIdleShield - transitions between core and idle mode
  • mas_mumuToIdleShield - transitions between music menu and idle mode

global (zz_reactions)

Public versions of some key reaction functions

functions

  • addReaction - adds file reactions
  • mas_checkReactions - checks file reactions
  • mas_getSpriteObjInfo - gets sprite info from sprite reactions list
  • mas_finishSpriteObjInfo - cleanup actions for sprite reactions

global (zz_weather)

functions for rolling weather chances

functions

  • shouldRainToday - checks if it should rain today

global (zz_windowreacts)

checks for window reactability

imports

  • os
  • sys - windows only
  • win32gui - windows only
  • win32api - windows only
  • balloontip - nix only

vars

  • win_notif_quips - notification quips for windows
  • other_notif_quips - notification quips for nix

functions

  • mas_canCheckActiveWindow - checks if we can check the active window
  • mas_getActiveWindow - gets the active window name
  • mas_isFocused - checks if MAS is currently focused
  • mas_isInActiveWindow - checks if keywords are in the active window name
  • mas_clearNotifs - clears notifications that we generated
  • mas_checkforWindowReacts - checks if a windowreaction should occur and queues it
  • mas_resetWindowReacts - unlocks window reactions in window react db
  • mas_updateFilterDict - updates filter dict
  • mas_addBlacklistReact
  • mas_removeBlacklistReact
  • mas_notifsEnabledforGroup - checks if notifications are enabled for a group
  • mas_unlockFailedWRS - unlocks a window react if it failed to be shown
  • mas_tryShowNotificationOSX - trys to show a notification on mac
  • mas_tryShowNotificationLinux - trys to show a notification on linux

1

top

mas_chess (chess)

huge number of chess constants, chess dialogue vars, as well as chess checking functions. Also initializes the dialogue actions map and the chess quiplists

imports

  • os
  • chess.png

vars

  • quit_game - enables quitting a chess match

functions

  • isInProgressGame - checks if a pgn game is valid and in progress

global (defintions)

Properly sets persistent.steam

mas_randchat (definitions)

Sets up the random chatter functions and constants

functions

  • adjustRandFreq - adjusts random chatter frequency given a slider value
  • getRandChatDisp - converts random chatter frequency into a display string

evhand (event-handler)

Core action functions for Event's usage. All of this stuff should be internal only.

2

top

global (definitions)

Creates coffee related functions, also various other functions

functions

  • mas_brewCoffee - starts brewing coffee
  • mas_drinkCoffee - starts drinking coffee
  • mas_isCoffeeTime - checks if its coffee time
  • mas_resetCoffee - resets coffee vars
  • mas_canShowRisque - checks if we can show risque content
  • mas_getPlayerAge - gets the player age
  • mas_getRPYFiles - gets list of rpy files in the game dir
  • mas_hasRPYFiles - checks if there are rpy files in the game dir
  • mas_is18Over - checks if the player is over 18
  • mas_isFirstSeshDay - checks if given date is the first session date
  • mas_pastOneDay - checks if a one day has passed since a given datetime.date or datetime.datetime
  • mas_timePastSince - checks if a given amount of time passed since a given datetime.date or datetime.datetime

global (script-affection)

Creates the final farewell poem

4

top

global (definitions)

makes the mas_randchat store globally available

global (event-handler)

Maps event databases to codes and cleans yearset baclkist

functions

  • mas_lastSeenInYear - checks if an event label was last seen in a given year
  • mas_lastSeenLastYear - checks if an event label was last seen last year

mas_gtod (script-grammar)

grammar tip helper functions

imports

  • datetime
  • evhand

functions

  • has_day_past_tip - checks if a tip has been seen and a day has past

global (script-holidays)

Poems are defined here

global (script-islands-event)

adjust islands flag if needed

mas_ptod (script-python)

declares helper functions for python tips

imports

  • datetime
  • evhand

functions

  • has_day_past_tip - checks if a tip has been seen and a day has past
  • has_day_past_tips - multiple arg version of above function

global (updates)

Runs pre-script topics update code. Not really used

mas_calendar (zz_calendar)

calendar functions and season setting

functions

  • addSeasonEvents - adds seasons to calendar

5

top

Every topic is created at this init level. Avoid using this init level for anything else. We also use this init to generate the backup notes.

6

top

global (event-handler)

Creates all event database, also key functions

functions

  • mas_getEV - gets an event object via label
  • mas_getEVCL - only for calendar use.
  • mas_hideEVL - hides an event, using a code to determine database
  • mas_lockEVL - locks an event, using a code to determine database
  • mas_showEVL - shows an event, using a code to determine database
  • mas_stripEVL - strips conditional and action from an event, also removes from event list
  • mas_unlockEVL - unlocks an event, using a code to determine database`

9

top

global (updates_topics)

Runs the label that inits the updates store with update mapping data.

10

top

mas_anni (script-anniversary)

Sets up anniversary database as well as key anniversary adjusting functions

constants

  • ANNI_LIST - list of anniversaries in order of potential appearance

vars

  • anni_db - Event database for anniversaries

functions

  • _month_adjuster - adjusts months for a new start date
  • _day_adjuster - adjust days for a new start date
  • add_cal_annis - adds anniversaries to the calendar
  • clean_cal_annis - cleans anniversaries from the calendar
  • reset_annis - resets all anniversaries using a new start date
  • unlock_past_annis - unlocks all anniversaries that are past the current date

global (script-greetings)

This is just for the Listen option for the greetings. It removes seen labels and does resets if necessary.

global (updater)

Declares the background update check function

functions

  • mas_backgroundUpdateCheck - launches the background update check thread

global (updates)

Runs the version update migration scripts.

global (zz_hangman)

Inits the wordlists for hangman

songs (zz_music_selector)

sets music_volume to the current volume of the music channel

global (zz_music_selector)

Properly sets the custom music directory, current track and the available music choices.

global (zz_poems)

defines MASPoem class

global (zz_weather)

Weather class

classes

  • MASWeather - weather object class

11

top

global (script-topics)

Initializes the seen lists. They are not built until later.

vars

  • mas_rev_unseen - list of unseen Events
  • mas_rev_seen - list of seen Events
  • mas_rev_mostseen - list of most seen Events

mas_poems (zz_poems)

defines key poem-realted functions

15

top

mas_affection (script-affection)

Contains all the affection programming points, the logic to run those programming points, and wrapper functions around the core affection state comparators. Also initializes the variying talk / play menu quips NOTE: Makes a reference copy of the persistent NOTE: Makes a reference copy of the layout store.

imports

  • store
  • evhand
  • mas_layout

functions

NOTE: Most of these are programming points. No need to list them here

  • runAffPPs - runs the affection state programming points
  • runAffGPPs - runs the affection state group programming points

20

top

global (script-affection)

Declares all the globally available affection functions and poems

imports

  • datetime
  • mas_affection
  • mas_utils

vars

  • mas_apology_reason - the reason to apologize

functions

  • mas_FreezeGoodAffExp - freezes affection gains
  • mas_FreezeBadAffExp - freezes affection losses
  • mas_FreezeBothAffExp - freezes affection gains and losses
  • mas_UnfreezeGoodAffExp - unfreezes affection gains
  • mas_UnfreezeBadAffExp - unfreezes affection losses
  • mas_UnfreezeBothAffExp - unfreezes affection gains and losses
  • mas_betweenAff - checks if affection is between 2 states
  • mas_compareAff - compare-to function for comparing affection states
  • mas_compareAffG - compare-to function for comparing affection group states
  • mas_isMoniBroken - checks if current affection is broken (or lower/higher)
  • mas_isMoniDis - checks if current affection is distressed (or lower/higher)
  • mas_isMoniUpset - checks if current affection is upset (or lower/higher)
  • mas_isMoniNormal - checks if current affection is normal (or lower/higher)
  • mas_isMoniHappy - checks if current affection is happy (or lower/higher)
  • mas_isMoniAff - checks if current affection is affectionate (or lower/higher)
  • mas_isMoniEnamored - checks if current affection is enamored (or lower/higher)
  • mas_isMoniLove - checks if current affection is love (or lower/higher)
  • mas_isMoniGSad - checks if current affection group is sad (or lower/higher)
  • mas_isMoniGNormal - checks if current affection group is normal (or lower/higher)
  • mas_isMoniGHappy - checks if current affection group is happy (or lower/higher)
  • mas_updateAffectionExp - sets the affection states to the correct value and runs affection programming points when appropriate
  • mas_gainAffection - increases affection
  • mas_loseAffection - decreases affection
  • mas_setAffection - sets affection to a value
  • mas_checkAffection - pushes an appropriate event based on affection level
  • mas_setApologyReason - enables an apology
  • _mas_getAffection - gets raw affection value
  • _mas_getBadExp - gets bad aff exp setting
  • _mas_getGoodExp - gets good aff exp setting
  • _mas_getTodayExp - gest today aff exp setting

21

top

mas_sprites_json (zz_spritejsons)

Initializes key sprite json related constants

imports

  • json
  • store
  • mas_utils

constants

  • SP_ACS - sprite type for ACS
  • SP_HAIR - sprite type for hair
  • SP_CLOTHES - sprite type for clothes
  • SP_CONSTS - tuple of all spriet types
  • SP_STR - sprite type to string name mapping (for debug use)
  • SP_UF_STR - sprite type user friendly string name mapping
  • SP_PP - sprite type to prog point format
  • SP_RL - sprite type to reaction label format

vars

  • giftname_map - maps giftnames to sprite type and name
  • namegift_map - maps sprite type and name to giftname

100

top

global (screens)

sets up the appropriate layout vars for ui text

global (zz_calendar)

declars a function for adjusting the conditional of the start date Event

functions

  • mas_chgCalEVul - literally just changes conditional for the state date Event

189

top

mas_sprites_json (zz_spritejsons)

json parsing functions

imports

  • mas_sprites as sms
  • mas_selspr as sml

190

top

mas_sprites_json (zz_spritejsons)

Checks for JSON sprites and adds them

200

top

mas_dockstat (zz_dockingstation)

Declares Monika's dockingstation function

imports

  • store
  • cStringIO
  • os
  • mas_greetings
  • mas_ics
  • mas_sprites
  • evhand
  • random
  • datetime
  • threading

functions

  • generateMonika - generates monika's new character file
  • findMonika - finds Monika's character file
  • init_findMonka - find Monika, init version
  • parseMoniData - parses monika character file data into components
  • selectReturnHomeGreeting - picks an appropriate greeting if we are returning monika to characters folder
  • diffCheckTimes - returns a timedelta difference between last checkin/checkout times
  • packageCheck - more generic package checking function that can do either signForPackage and createPackageSlip
  • checkinMonika - checks Monika into the docking station
  • checkoutMonika - checks Monika out of the docking station
  • getCheckTimes - gets a corresponding checkin/checkout time for a given checksum

mas_selspr (zz_selector)

Loads selectable data.

205

top

mas_dockstat (zz_dockingstation)

Declares async promises.

imports

  • mas_threading

vars

  • monikagen_promise - MASAsyncWrapper object for generation Monika
  • monikafind_promise - MASAsyncWrapper object for finding Monika

functions

  • abortGenPromise - specifically aborts the generation promise in case we aborted it.

500

top

All images are built at this init level.

501

top

global (zz_overlays)

Declares overlay-related functions

functions

  • mas_OVLDropShield - enables all overlay screens
  • mas_OVLHide - hides all overlay screens
  • mas_OVLRaiseShield - disables all overlay screens
  • mas_OVLShow - shows all overlay screens

790

top

mas_piano_keys (zz_pianokeys)

Holds the functions for adding JSON songs to piano

imports

  • json

functions

  • addSong - adds a song to the PianoNoteMatchList database
  • addCustomSongs - parses the custom song folder for songs and adds them to the PianoNoteMatchList database
  • addStockSongs - adds a preset list of songs to the PianoNoteMatchList database

800

top

global (zz_backgrounds)

background changing functions

mas_piano_keys (zz_pianokeys)

Adds the stock and custom songs to the PianoNoteMatchList database. Also declares a function for generating the piano song menu.

functions

  • getSongChoices - generates a list of tuples for the piano song selection menu

global (zz_reactions)

Deletes files of reactions that failed to be deleted.

global (zz_weather)

Global weather functions, as well as setting the initial weather

functions

  • mas_setWeather - sets the weather without calling exit programming points
  • mas_changeWeather - sets the weather calling both entry and exit programming points

810

top

global (zz_pianokeys)

Creates the piano displayable

imports

  • mas_piano_keys

classes

  • PianoDisplayable - displayable that runs the piano

functions

  • pnmlLoadTuples - loads PianoNoteMatchList data from persistent into corresponding objects in the PianoNoteMatchList database
  • pnmlSaveTuples - saves PianoNoteMatchList data into persistent from corresponding objects in the PianoNoteMatchList database

899

top

global (chess)

inits the chess quiplist

900

top

In general, all DelayedAction constructor functions are built here.

global (screens)

Inits the quit messages for layout

970

top

global (script-ch30)

Checks for:

  • monika's file
  • file reactions
  • bday stuff
  • o31 stuff

imports

  • mas_filereacts

994

top

mas_delact (event-handler)

Sets up the DelayedAction map

constants

  • MAP - Maps DelayedAction IDs to constructor functions

functions

  • loadDelayedActionMap - generates the runtime map of DelayedActions from persistent
  • saveDelayedActionMap - saves the runtime map of DelayedActions to persistent

995

top

global (event-handler)

Runs DelayedActions at the init stage

999

top

global (updates)

Runs the late update scripts