Intro to Scripting

What the hey is all this?

What is Scripting?

Scripting is the act of writing a script.

  • Scripts are a text files containing human-readable code. These instructions are meant to be interpreted by another program, rather than your computer's processor.

A program for interpreting scripts is called a compiler.

  • Compiling is the act of converting human-readable code to machine language.

  • A Binary is what we call the output, usually a single game file.

Atlus games use scripts to perform various logical procedures.

  • Giving the player items, skills, or money

  • Showing message windows or choosing options in a menu

  • Playing sound effects or loading fields/events/battles

  • etc. etc. etc. ...

I bet you can already picture how this opens tons of doors for modding. However, Atlus scripts have already been compiled. Normally, we wouldn't be able to do much with these files, since they only exist as binaries. But now we have TGE's AtlusScriptCompiler, which can:

What is Flowscript?

To answer that, let's go over these proprietary Atlus binary formats.

  • BF (binary flow) The compiled form of Atlus's scripts.

  • BMD (binary message data) Another binary format often found embedded within.BF files. These contain text and markup.

.FLOW and .MSG

AtlusScriptCompiler supports two unique script formats.

  • Flowscript (.FLOW) A human-readable scripting language designed by TGE. It mimics the original script format .BF files were created from.

  • Messagescript (.MSG) TGE's answer to .BMDas a script format. It contains text with markup that can be linked to a .FLOW script.

Altogether, this makes it possible to edit and create .BF and .BMD files.

What does .FLOW look like?

Flowscript (.FLOW) looks similar to C, so anyone familiar with object-oriented programming should feel right at home.

Don't be intimidated! This guide is geared toward complete beginners. By the end, you should be able to easily create your own scripts-- even if you've never programmed before.

The following is an example of a simple menu in Persona 5. See if you can surmise what's happening!

// Import the MessageScript into the script
import( "TestScript2.msg" );
// Main Script Procedure
void Main()
{
// Display dialog window (by message name)
MSG_WND_DSP();
// Display dialog (by message name)
MSG( HelloDialog, 0 );
// Display selection menu (by message index)
int selection = SEL( 1 );
// Close dialog window
MSG_WND_CLS();
// Do whatever you selected
switch ( selection )
{
case 0:
// Get Player Resource Handle
int playerResHandle = FLD_PC_GET_RESHND( 0 );
// Change Player Model Size
FLD_MODEL_SET_SCALE( playerResHandle, 2f );
break;
case 1:
// Go to Field 000_002
CALL_FIELD( 0, 2, 0, 0 );
break;
default:
break;
}
}
...

What does .MSG look like?

Messagescript is even more straightforward. See below for an idea of how dialog and selections are labelled and formatted.

// Index 0 [dlg BossRushModeDialog [TGE]] [f 2 1]Select a boss fight.[f 1 1][e]

// Index 1 [sel SelectBoss0] [f 2 1]D00_SCENARIO_BATTLE_01[e] [f 2 1]D01_01_SCENARIO_BATTLE_01[e] [f 2 1]D01_01_MORUGANA_BATTLE[e] [f 2 1]D01_02_SCENARIO_BATTLE_01[e] [f 2 1]Previous[e] [f 2 1]Next[e]

Getting Started

To make full use of this guide, you will need...

  • A PC running Windows

  • Extracted files from the game you're modding

  • An open mind :)

Read on for how to get started with the program.