Links

Intro to Scripting

What the hey is all this?
Persona games feature their own built-in scripting engine. With a basic understanding of coding, you can build completely custom experiences into your mod. This is a chance for your creativity to shine as you work with the limited (yet robust) tools that the game provides us.
You do NOT have to have any prior knowledge of programming to follow this tutorial. However, I do recommend watching at least the first 3 videos from Harvard's CS50 playlist. A lot of the same concepts apply here, and these videos lay them all out for you in an easy-to-digest fashion.
Harvard's CS50 YouTube playlist gets you familiar with thinking like a programmer and using code to solve real life problems.

So, 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.
An example of the kind of scripts you will see and be able to create in Persona 5.
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.
An example of a script being converted into a binary file using a compiler.
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. ...
The compiled binary is unreadable to humans, but the game can understand it perfectly.
I bet you can already picture how this opens tons of doors for modding. Scripts found in the game have already been compiled. Normally, we wouldn't be able to do much with these files, since they only exist as binaries.
But thanks to clever reverse engineering, we have TGE's AtlusScriptCompiler. This program 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! The comments are there to help you make sense of things.
// 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.