Skip to content
This repository has been archived by the owner on Dec 4, 2021. It is now read-only.

Legacy functions

Taz edited this page Jul 15, 2021 · 5 revisions

IMPORTANT: These have been copied directly from the V1 documentation. While these functions still exist, they have been reimplemented hastily into V3 API, and probably will not work identically to how they are described here. This page exists only to help people who have already written their mod to use the V1 API. Do NOT use these functions if you can help it.


To add a callback, use the following function

MMC.AddMusicCallback(
    table ref,
    function callbackFn,
    Music trackId1,
    Music trackId2,
    ...
)
  • ref is your mod table. This is required and the script will error if you use a different table.
  • callbackFn is the function that is called everytime a track is about to play. For callbackFn:
  • The music ID is given as the first argument.
  • You can find some examples here.

The function can:

  • Return a track Id to play that instead.
  • Return jingle Id, track Id to play a jingle and queue the track.
  • Return 0 to prevent the track from playing, and allow the current one to continue
  • Return -1 to stop all music
  • Return nil to continue to internal code

Any arguments given after the callback function are required track IDs. If any are given, then the music about to play must be one of the track IDs for the function to be called. (eg, you give all treasure room jingles as required track IDs, your function will only be called when one of these is about to play)

Callbacks added first will take priority.

MMC.GetMusicTrack()

This function simply returns the intended track ID of the room you are in. Sometimes this is two values, for example when visiting a treasure room for the first time.

WARNING! Using this in an uncleared boss room may not return the desired result. If you want the intended boss music, use:

MMC.GetBossTrack()

Returns the intended boss room entry music for this room (eg Satan, Mom). If not in a boss room, it will simply return one of the two(?) generic themes.

WARNING! The function always returns the entry music, not the current one. For example in Hush's boss room, the ID returned will always be ???'s theme, even if Hush is in his final form.

MMC.GetStageTrack()

Returns the stage music track, regardless of room properties.

MMC.Manager()

Returns MusicManager().

Clone this wiki locally