🦊



Basics
Flowscript
Messagescript
Decompiling
Compiling

Features
Importing
↳ Declaring Functions
↳ Declaring Variables
Hooking Functions

P5 Functions
↳ AI
↳ Common
↳ Facility
↳ Field
↳ Net
↳ Social

Messagescript

Flowscript doesn't support strings as a variable type, but it's possible to display text in the form of dialog and selectable options by referencing a messagescript file.

Creating a Messagescript

Messagescripts are text files ending with the extension .msg, often accompanying a .flow (flowscript). Simply create a new text file and rename the extension. You may need to make Windows display known file extensions in order to change .txt to .msg.
Below is a sample from a custom messagescript.
[dlg BossRushModeDialog [TGE]]
[f 2 1]Select a boss fight.[f 1 1][e]

[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]

There are two types of message declarations: dialog and selection.
Brackets that start with dlg or msg...
  • Can be used for dialog boxes, window labels etc.
  • Have a unique name (i.e. BossRushModeDialog )
  • Can have an optional nametag in brackets (i.e. [TGE] )
  • Have a message on the next new line, starting with [s]/[f 2 1] and ending with [e].
  • Can have multiple messages on new lines as long as they come before the next message declaration.

Brackets that start with sel...
  • Can be used for menu options.
  • Have a unique name (i.e. SelectBoss0 )
  • Have a message on the next new line, starting with [s]/[f 2 1] and ending with [e].
  • Can have multiple messages on new lines as long as they come before the next message declaration.

Using Markup

You can change the appearance of text by inserting the following codes (in brackets) into your message.

Referencing Messages in Flowscripts

By importing the messagescript into the flowscript, you can reference messages in two ways: by ID or by the message's unique name. For instance, here's an example of a dialog box that references the messagescript sample above.
import( "TestScript2.msg" );

void StartBossrushMode()
{
	// Display the dialog window
	MSG_WND_DSP(); 
	// Display dialog
	MSG( BossRushModeDialog, 0 );
	// Close the dialog window
	MSG_WND_CLS(); 	
}
MSG(BossRushModeDialog, 0) actually yeilds the same results as MSG(5, 0) since (counting up from 0) BossRushModeDialog is the fifth selection or dialog message with a unique name in the msg file. Here's an example of a selection that returns an integer (the index of the string from the referenced [sel] message).
// Display dialog window
MSG_WND_DSP(); 
MSG( HelloDialog, 0 ); 
// Display selection options while dialog is still shown
int selection = SEL( 1 );
MSG_WND_CLS();
SEL(1) in this case refers to this message in the messagescript file. You can use the value it returns to decide what to do with the selected option in-game:

switch ( selection )
{
	case 0:
		int playerResHandle = FLD_PC_GET_RESHND( 0 );		
		FLD_MODEL_SET_SCALE( playerResHandle, 2f );
		break;
	case 1:
		CALL_FIELD( 0, 2, 0, 0 );
		break;
	case 2:
		StartBossrushMode();
		break;
	case 3:
		StartTeleportMode();
		break;
	case 4:
		StartButtonTestMode();
		break;
	case 5:
		StartSoundTestMode();
		break;
	default:
		break;
}

We are not affiliated, associated, authorized, endorsed by, or in any way
officially connected with ATLUS, SEGA, or any of its subsidiaries or its affiliates.
The official ATLUS website can be found at https://atlus.com. "Persona", as well
as all characters referenced on this page are registered trademarks of ATLUS.