Skip to content
ThePotatoGuy edited this page Nov 14, 2018 · 44 revisions

This page will be explanation of all the init levels we use in MAS, which should act as a helpful timeline of startup events.

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.
  3. persistents are backed up at -900.
  4. DelayedActions can be built after -880.
  5. Pre-adding DelayedActions can happen after -880.
  6. DelayedAction creation functions need to be defined before -875
  7. Historical data saving happens at -800.
  8. The lock db can be used after -500.
  9. Docking Station can be used after -45.
  10. Affection's numerical value can be loaded after -10.
  11. Monika images can be built after -5.
  12. All topics are created at 5.
  13. Update migration mapping is setup at 9.
  14. Update scripts run at 10.
  15. Affection functions can be used after 20.
  16. Selectable data is loaded from persistent at 200.
  17. Images are built at 500.
  18. Overlays can be hidden/shown/enabled/disabled after 501.
  19. Piano JSONS are loaded at 800.
  20. DelayedAction runtime map is loaded at 994.
  21. Init-stage DelayedActions are run at 995.
  22. 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.

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

-990

top

mas_utils (definitions)

Core utility functions are defined here

imports

  • store
  • os
  • shutil
  • datetime

functions

  • clean_gui_text - cleans gui text by removing key symbols
  • tryparseint - attempts to parse a value into an int
  • copyfile - copies files from one location to another
  • writelog - writes messages to mas log
  • trydel - attempts to delete a file at a path
  • logrotate - does a log rotation for a given log
  • tryparsedt - attempts to parse a string into a datetime
  • trywrite - attempts to write a file

-900

top

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

-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.

-876

top

In general, all MASDelayedAction constructor functions are built here.

mas_delact (script-greetings)

Contains MASDelayedAction constructor functions for greetings

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.

-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_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_HistVerify - checks if some data matches what was stored in the archives at one point. (checks multiple years)

-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 (zz_history)

Where programming points for MASHistorySaver objects can be defined.

imports

  • _MDA_safeadd from mas_delact

-810

top

Most MASHistorySaver objects are created here.

global (script-holidays)

Creates the MASHistorySaver object for o31.

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

-100

top

mas_utils (definitions)

Initializes utility functions, mainly ones not needed super early

imports

  • datetime
  • ctypes
  • random
  • cStringIO.StringIO

functions

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

global (splash)

checks if the DDLC archives are in the game folder.

-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)

-20

top

global (zz_selector)

Declares selectable classes.

classes

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

-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

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

-10

top

global (script-affection)

Declares affection loading/saving functions.

global (script-islands-event)

Decodes images.

vars

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

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.

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_selspr (zz_selector)

Declares selection screen constants and functions, and the selectable mailbox class

imports

  • store
  • mas_utils

constants

  • MB_DISP - display text mailbox constant
  • MB_DISP_DEF - default display text mailbox constant
  • MB_CONF - confirm flag enable mailbox constant
  • SELECT_ACS - accessory selection type constant
  • SELECT_HAIR - hair selection type constant
  • SELECT_CLOTH - clothes selection type constant

vars

  • ACS_SEL_MAP - accessory selectables map
  • ACS_SEL_SL - accessory selectables sorted list
  • HAIR_SEL_MAP - hair selectables map
  • HAIR_SEL_SL - hair selectables sorted list
  • CLOTH_SEL_MAP - clothes selectables map
  • CLOTH_SEL_SL - clothes selectables sorted list

functions

  • init_selectable_acs - ints a selectable for an accessory.
  • init_selectable_clothes - inits a selectable for clothes
  • init_selectable_hair - inits a selectable for hair
  • save_selectables - saves selectable data to persistent
  • load_selectables - loads selectable data from persistent
  • get_sel_acs - gets the selectable for an accessory
  • get_sel_clothes - gets the selectable for clothes
  • get_sel_hair - gets the selectable for hair
  • lock_acs - locks selectable for an accessory
  • lock_clothes - locks selectable for clothes
  • lock_hair - locks selectable for hair
  • unlock_acs - unlocks selectable for an accessory
  • unlock_clothes - unlocks selectable for clothes
  • unlock_hair - unlocks selectable for hair

classes

  • MASSelectableSpriteMailbox - mailbox specific to selection screen mechanics

global (zz_transforms)

only one thing. the image existence checker

functions

  • getCharacterImage - retrieves the Displayable of a character + expression

-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

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

-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_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_poemgame_fun (zz_poemgame)

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

-1

top

_mas_root (definitions)

contains very powerful functions. not for the faint of heart

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

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_cvToHM - converts minutes into hour / minutes
  • 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
  • mas_cvToDHM - converts miniutes into a displayable form of hour / minutes
  • 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.

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
  • 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 greetings/farewells should be shown NOT UNLOCKED

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)

constants and core functions for the Affection system, as well as setting up the audit log

imports

  • os
  • datetime
  • mas_utils
  • store

constants

NOTE: too many constants here. Most are state-related and/or contain the thresholds for different states. Only listing the important order lists / maps here.

  • _aff_order - affection states in the "natural order" of affection, from lowest to highest
  • _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

functions

  • audit - function for affection change auditing

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

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

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

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

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

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

global (sprite-chart)

initializes MASAccessory, MASHair, and MASClothes objects

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_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
  • 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

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)

global (zz_selector)

Declares displayable for selectables

imports

  • random

classes

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

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

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.
  • global versions of hideEvent*/lockEvent*/unlockEvent* functions
  • 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

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-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
  • is_morning - 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

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 (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

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_MUMUDropShield - enables the music menu
  • mas_MUMURaiseShield - disables the music menu

global (zz_reactions)

Public versions of some key reaction functions

functions

  • addReaction - adds file reactions
  • mas_checkReactions - checks file reactions

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

functions

  • mas_isCoffeeTime - checks if its coffee time
  • mas_brewCoffee - starts brewing coffee
  • mas_drinkCoffee - starts drinking coffee
  • mas_resetCoffee - resets coffee vars

global (script-affection)

Creates the final farewell poem

4

top

global (definitions)

makes the mas_randchat store globally available

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

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.

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.

11

top

global (script-topics)

Builds the event lists and sets seen limit to huge amount if necessary.

vars

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

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

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_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

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

101

top

global (script-holidays)

sets up holiday related start up stuff

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

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.

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

850

top

global (event-handler)

Creates the centralized Event database for easy lookup

vars

  • mas_all_ev_db - Event database that contains all Events

functions

  • mas_getEV - gets an Event object from the centralized database
  • mas_getEVCL - gets a calendar label for an Event object

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