Features of MysteryMail Rehearsal - Adex-8x/mmr-patches GitHub Wiki

MysteryMail Rehearsal is powered by various ASM and C patches featured in SkyTemple, mmr-patches, and the community as a whole! The included custom code helps participants perform various scripting techniques that go above and beyond the existing base game's mechanics. This page serves as an explanation of all the noteworthy inclusions that participants should be aware of.

SkyTemple Patches

  • ActorAndLevelLoader
  • BoldText
  • ChangePokemonGroundAnim: Allows for changing the default idle animation used by any Pokémon in ground mode. To clarify, not all Pokémon have the same idling animation when a command such as SetAnimation(2); is used in a script. A Pokémon like Flygon would loop its idle animation (flapping its wings), but a Pokémon like Feraligatr would stand still on one frame of its idle animation. This patch lets you assign which idle type you'd like for any given Pokémon species!
  • ChangePortraitMidText
  • ChangeTextboxBackground: Allows for easy manipulation of the textbox background color!
  • ChangeTextSound
  • DisplayScriptVariable
  • ExpandPokeList: Participants looking to add new Pokémon to MMR need not worry about running out of potential slots! Any DmyPk entry in the game represents an unused entry, so feel free to fill that in with a Pokémon of your choice!
  • ExtraSpace: Please note! The mmr-patches repository makes heavy use of Overlay36. If you are planning to write your own custom code for the hack, please view the contribution guidelines for usable regions.
  • ExtractObjectTable
  • ExtractSPCode: Contributors looking to include new special processes may either contribute ASM code to be imported via this patch, or written directly in C.

Currently, we feel as though no other SkyTemple patches should be included in MMR. Applying SkyTemple patches not listed here (barring the ExpandPokeList dependencies) is strictly prohibited.

mmr-patches Code

Script Variable Convention

Any variable not currently listed is fair game to use in scripts or custom code! While scripting, however, it is strongly encouraged that you initialize your used variables at the start of your scene, to prevent any conflicts when scenes are all played sequentially.

Special Processes

  • 100: ChangeBorderColor. Changes the border/frame color of the textbox.
    • Param 1: Frame Color
      • 0: Blue
      • 1: Pink
      • 2: Green
      • 3: Orange
    • Param 2: Unused
    • Returns: Always 0
  • 101: SetTextboxTransparency. Changes the inner textbox window to be solid or transparent.
    • Param 1: Transparency State (0 for solid, anything else for transparent)
    • Param 2: Unused
    • Returns: Always 1
  • 102: ChangeTextboxColor. Changes the inner textbox window to a different color.
    • Param 1: Color
      • 0: Red
      • 1: Green
      • 2: Blue
      • 3: Alpha
    • Param 2: Value
    • Returns: Always 1
  • 103: ResetTextboxColor. Resets the inner textbox window to its default color (#202020). No parameters; always returns 1.
  • 104: CreatePerformers. Creates two performers (0 and 1) without the need of an associated SSA, SSE, or SSS file. No parameters; always returns 581. Not likely needed by participants.
  • 105: SwapFont. Swaps one of the two font tables in memory out with another. FONT/kanji_rd.dat is the "main" font table with the regular PMD2 font; FONT/unkno_rd.dat is the Unown font table. New files formatted similarly to the aforementioned font files may be added to the MMR ROM and used with this special process!
    • Param 1: Filepath to the font file
    • Param 2: True (1) to replace FONT/unkno_rd.dat, False (0) to replace FONT/kanji_rd.dat.
    • Returns: Always 1

Custom Dialogue Box Formats

If script variable $PERFORMANCE_PROGRESS_LIST[62] is enabled (i.e., set to 1), the game will pick all of its textbox attributes from the six indexed values of $SCENARIO_SUB1, $SCENARIO_SUB2, and $SCENARIO_SUB3! The values are as follows:

  • $SCENARIO_SUB1[0]: X Offset
  • $SCENARIO_SUB1[1]: Y Offset
  • $SCENARIO_SUB2[0]: Width
  • $SCENARIO_SUB2[1]: Height
  • $SCENARIO_SUB3[0]: Screen (0 for Touch Screen, 1 for Top Screen)
  • $SCENARIO_SUB3[1]: Frame (usually this is 0xFD, but 0xFA will display no visible textbox, similar to message_Explanation)

Please keep in mind for $SCENARIO_SUB1 and $SCENARIO_SUB2, its values are essentially pixels multiplied by 8 when displayed. A helpful macro to use when scripting could be:

macro set_dbox_attributes($x_offset, $y_offset, $width, $height, $screen, $frame) {
    $PERFORMANCE_PROGRESS_LIST[62] = 1;
    $SCENARIO_SUB1[0] = $x_offset;
    $SCENARIO_SUB1[1] = $y_offset;
    $SCENARIO_SUB2[0] = $width;
    $SCENARIO_SUB2[1] = $height;
    $SCENARIO_SUB3[0] = $screen;
    $SCENARIO_SUB3[1] = $frame;
}

Then, an example of this macro's call would be: ~set_dbox_attributes(0x2, 0x11, 0x1C, 0x5, 0x0, 0xFD);. Incidentally, this series of attributes represents the game's default dialogue box format!

Text Tags

  • [U:X]: Unlock Script Lock X.
  • [VAR:X:Y:Z]: Set script variable X at index Z to value Y. The third parameter is optional, and if missing, will default to 0.
    • For example, [VAR:93:1] will set $DUNGEON_EVENT_LOCAL to 1, but [VAR:17:0:4] will set $SCENARIO_MAIN_BIT_FLAG[4] to 1.
    • Note that this is different from the [var:x:y] text tag introduced in DisplayScriptVariable!
  • [VS:X:Y]: Modify text speed by a multiplier of X/Y. The second parameter is optional, and if missing, will default to 1. This was originally written by Irdkwia!
    • For example, [VS:1:2] halves speed, but [VS:4] quadruples it.
  • [VR]: Revert text speed to its default speed; equivalent to performing [VS:1:1] or [VS:1]. This was originally written by Irdkwia!

Misc. Community Patches

  • snd_stream (Stereo ADPCM Edition) by Adakite & Irdkwia: Participants with a knowledge of SkySongBuilder may add streamed music to MMR with certain limits in place.
    • Maximum of two streamed tracks per scene
    • Combined duration of a scene's track(s) must not exceed five minutes

And speaking of SkySongBuilder, there is no restriction on sequenced music! (Note: The version applied in MMR is a hotfix designed for the streamed music to play on hardware.)