SSB files are always found with an associated .SSA, .SSE, or .SSS file, with the single exception of unionall.ssb, found in the /SCRIPT/COMMON/ folder of the Nitro File System. These files contain the actual scripting code, much like the canon series of Pokémon games. The main differences are the number and format of these commands.
SSB files are all 16-bit word-based. Because of this, the file itself must be an even number of bytes, and in fact the string and constant tables have special rules to ensure this.
Special cases
unionall
This file is a very special case for two reasons. It does not have an SSA, SSE, or SSS file connected with it, and it stays in memory for the entire time scripts are being run.
This is the master script that is the first to run when the power is turned on, and handles all the scene changes, events, and anything else that can be scripted. The entire titlescreen is run with unionall.ssb, as is the entire game. It is the ONLY script that is called through ASM, and is put in a very special location in memory, staying there until the game is turned off.
When scripts end that this script calls, the script continues from where it left off, doing various things depending on the outcome of these scripts. More research needs to be done to find out everything this script does.
File Format
Header
The header format differs slightly depending on the game's region. This is because while the US version stores only 1 language, the European game stores 5, each in its own string table.
Header (US)
Hex
Short Name
Description
00
numConst
The number of 'constants' in the file
02
numString
The number of 'strings' in the file
04
offsetConst
First const offset or beginning of string table
06
sizeConst
Size of the 'constant' table (in words)
08
sizeString
Size of the 'string' table (in words)
0A
unknown
Unknown
0C
data...
Script data
...
Header (European)
Hex
Short Name
Description
00
numConst
The number of 'constants' in the file
02
numString
The number of 'strings' in each string table
04
offsetConst
First const offset or beginning of string table
06
sizeConst
Size of the 'constant' table (in words)
08
sizeEnglish
Size of the 'English' table (in words)
0A
sizeFrench
Size of the 'French' table (in words)
0C
sizeGerman
Size of the 'German' table (in words)
0E
sizeItalian
Size of the 'Italian' table (in words)
10
sizeSpanish
Size of the 'Spanish' table (in words)
12
data...
Script data
...
Data
Header
Hex
Short Name
Description
00
LEN
Length of data, usually first constant offset + 2*numConst
02
numGroups
The number of 'groups' in the file
04
entry... (numGroup entries)
Group entries
06
08
...
more groups if numGroups > 1
extra groups, up to numGroups
...
commands... (LEN words)
Script commands area
Groups
Hex
Short Name
Description
00
scriptLoc
Commands location (will always be at the start of a valid command)
02
type?
possibly the type of group? unsure
04
unknown
Unknown (char if type=3?)
Commands
Main article: Table of PMD2 Scripting Commands
Time/Darkness
Time has 0x150 commands in total in its scripting subsystem. It is currently unknown what every one does, but a lot have been figured out.
Sky
Sky has 0x180 commands in total in its scripting subsystem. It is currently unknown what every one does, but a lot have been figured out. Also, EVERY command from Time is in these commands as well. This means there are 0x30 new commands introduced in Sky. Some of the old commands are also changed slightly.
The introduced commands were inserted into various locations in the time commands, which means the same command in Time/Darkness and Sky usually has two different command numbers. For example, 0x8B in Time is the same as 0x9D in Sky.
Constants/strings tables
If there is nothing in a particular table, then that table is omitted. The strings table strings are at (offset from string table) + (LEN).
The constant table strings have offsets as if they were part of the string table. Therefore, the constants are actually at (offset from const table) + (LEN) - (2 * numStrings). Another way of calculating the constants offset is assume the first offset leads to offsetConst, subtract the first offset from all the others and you will get the offset from offsetConst. Or (offset from const table) - (first offset from const table) + (offsetConst)
Regardless of the table, if the size in bytes of the table + offsets is an odd number, then an extra null byte is added to the end of the otherwise complete table before being stored.
Constant table entry
0000: (word) start of string + 2* num strings.
String table entry
0000: (word) start of string (from the beginning of the string table).
Const/String
The differences between these two types of strings are unknown. What is known is as follows:
Every constant and every string is null-terminated.
Constants are always in all-caps
Strings can hold special formatting instructions and be any conceivable length
Commands that accept strings will also accept constants and display them as if they would a string.
Commands that accept constants can conceivably accept strings, but it is unknown if this will work in most cases
Notes
Constant Locations
Constant offsets - 2*numStrings = actual constant locations.
It is unclear why this is the case, but it is clear that the script commands act as if constants and strings were all in the same big array.

.SSA, .SSE, and .SSS files all use the exact same format, and as far as is currently known all do the same things. The only differences appear to be which links exist. These files and their respectively named .SSB files are effectively linked, as within the script they are not called by extension, but by name.
These are never found alone. They are like C/C++ .h files, in that they are connected to a certain file, and therefore useless by themselves. They are used to determine the starting positions of Pokémon, backgrounds, and interactable areas (including ones that you simply move into to interact). There are still some secrets that are unknown, however.
All data contained in these files is in groups of words. Word (as defined here) refers to the 16-bit word, or the values between 0x0000 and 0xFFFF inclusive. It is also referred to as a short in most common programming languages (on 32-bit OS's and above), or a 'halfword' as in the ARM processors used in the NDS.
Specifics
SSE
The only known .SSE file is 'enter.sse' All known links from this file go to other enter files, 'enterXX.ssb', and the files are all linked. All the Pokémon, backgrounds, etc. in this file are used as initial positions for all enter files.
This file will always exist in every subfolder of /SCRIPT/, that describes an area that can be entered by the player during normal play. (some folders contain visual effects, or only cutscenes)
SSS
There are two types of .SSS files. The first is 'umXX.sss', and the second is 'usXX.sss'. In both cases, the XX can stand for any decimal number. Differences between the two types are unknown at this time.
umXX.sss
These are linked to all the umXXYY.ssb files where XX is the same in both files. The links themselves are determined in the .SSS file
usXX.sss
These are linked to all the usXXYY.ssb files where XX is the same in both files. The links themselves are determined in the .SSS file
SSA
Every other known .SSB file, with one exception, has this file as a "metafile" of sorts, showing all initial locations, background areas, etc. A file named 'm22a0201.ssb', for example, would have 'm22a0201.ssa' as this file. The sole exception to this rule is unionall.ssb, contained inside the /SCRIPT/COMMON/ folder. It has no .SSA, .SSE, or .SSS file connected with it.
File Format
Items with question-marks are unknown at this time, but believed. Short names are only to give a simple mnemonic to remember by. These names are not used inside the game
Header
Hex
Short Name
Description
0000
numGroups (N)
The number of 'groups' in the file (N)
0002
dataOffset (Z)
Length of non-groups/start of groups (Z)
0004
unkn (A)
Start of something (only enter.sse?)
0006
pokéPos (B)
Pokémon posititions
0008
objPos (C)
Object positions
000A
backPos (D)
Default backgrounds (pos?)
000C
unknown (E)
Start of third non-6 group
000E
movements (F)
Start of movements (actions)
0010
4wordsLoc (G)
start of 4 unknown words (usually 9, -1, -1, -1)
A words from start
This is apparently usually only used in enter.sse.
Hex
Short Name
Description
00
unknown1
Unknown
02
unknown2
04
unknown3
06
entryNum
Number entry (enterXX.ssb if enter.sse) to go to.
B words from start: (chara group)
Hex
Short Name
Description
00
pokémon
Pokémon to change
02
faceDir
Direction to face
04
xPos
X coordinate -- 8 pixel increments. -- 0 = half of shadow there
06
yPos
Y coordinate -- 0 = Shadow 1 pixel down
08
xOffset
x offset? 0-1, 2-3, 4-7 = 0, 4, 16
0A
yOffset
y offset? 0-1, 2-3, 4-7 = 0, 4, invis
0C
entryNum
Numbered entry (XX in enterXX.ssb if enter.sse), usually FFFF (means none)
0E
unknown
Unknown, usually FFFF
C words from start:
This group works with objects. Each group of 8 words defines a new object, and has the following structure:
Hex
Short Name
Description
00
object
Object to change
02
unknown1
Unknown
04
unknown2
06
unknown3
08
xPos
X coordinate -- 8 pixel increments. -- 0 = half of shadow there
0A
yPos
Y coordinate -- 0 = Shadow 1 pixel down
0C
xOffset
x offset? 0-1, 2-3, 4-7 = 0, 4, ?
0E
yOffset
y offset? 0-1, 2-3, 4-7 = 0, 4, ?
10
entryNum
Numbered entry (XX in enterXX.ssb if enter.sse) to run on interact, usually FFFF (means none)
12
unknown4
Unknown, usually FFFF
D words from start
Deals with backgrounds.
Hex
Short Name
Description
00
object
Spot used in code B1 (EoT/EoD)
02
unknown1
Unknown
04
unknown2
06
unknown3
08
xPos
X coordinate -- 8 pixel increments.
0A
yPos
Y coordinate
0C
xOffset
x offset? 0-1, 2-3, 4-7 = 0, 4, ?
0E
yOffset
y offset? 0-1, 2-3, 4-7 = 0, 4, ?
10
entryNum
Numbered entry (XX in enterXX.ssb if enter.sse) to run on interact, usually FFFF (means none)
12
unknown4
Unknown, usually FFFF
E words from start
Hex
Short Name
Description
00
what?
What to change?
02
unknown1
Possibly facing?
04
xPos?
X coordinate?
06
yPos?
Y coordinate?
08
xOffset?
x offset?
0A
yOffset?
y offset?
0C
entryNum?
All that is known is this is NOT enterXX.ssb numbers
0E
unknown2
Unknown, usually FFFF
F words from start
Deals with movements.
Hex
Short Name
Description
00
xPos?
X coordinate? -- 8 pixel increments.
02
yPos?
Y coordinate?
04
xOffset?
x offset?
06
yOffset?
y offset?
08
unknown1
Unknown
0A
unknown2
0C
unknown3
0E
unknown4
G words from start
Hex
Short Name
Description
00
unknown1 (9)
Usually 0009
02
unknown2 (-1)
Usually FFFF
04
unknown3 (-1)
06
unknown4 (-1)
Z words from start
Not much is known about this group, other than the fact it is always 10*N words long.
Hex
Short Name
Description
00
unknown1
All are apparently used, a lot of repeats
02
unknown2
04
unknown3
06
unknown4
08
unknown5
0A
unknown6
0C
unknown7
0E
unknown8
10
unknown9
12
unknown10