Flags

Flags are used to keep track of tons of different state throughout the game. This includes temporary state, like a dialogue choice or who won a battle, as well as long-lived state, like cleaning upgrades or story progress.

Flags are written like <3 9>, where the first number identifies the flag, and the second is a kind of 'type' (most likely). The main places they're used are in cutscene (DEX) and cutscene trigger (DEP) files.

Types

Though we call them "types", it's not entirely clear what they're actually used for. The same ID with two different types seems to refer to the same flag1, but then why have the type at all? Meanwhile the DEX and DEP commands that deal with flags usually take the same 1 or 2 types every time, so clearly there's some significance.

It's entirely possible that they aren't actually types at all. In their raw form, a flag looks like <0x3000009>, so it's not completely certain that these are two separate values. It's possible the 'type' is actually more of a 'category', and the usage patterns we see are for organizational reasons, not technical.

TypeShort nameNotes
0Used only in DEX files, usually for the results of dialogue choices. DEP files react to these flags, but never use type 0 (they might use 8? or maybe 9?)
2, 3EventUsed only in DEP files, specifically for the 'event has (not) played' commands
5BooleanUsed all over for true/false values, like story progress flags or battle win/lose results
6BooleanWhether the player currently has a particular key item
7BooleanWhether the player has a particular mask unlocked
8IntegerUsed with number-style commands, like addition, subtraction, less-than, and others
9IntegerSame as 8, but seems to be used for player data, like money or current mask
10BooleanWhether the player has a certain feature unlocked

Known flags

IDNotes
<1 7>Dropping Mask unlocked
<2 7>Hip-Shaker Mask unlocked
<3 7>Stone Mask unlocked
<4 7>Gold Mask unlocked
<5 7>Samurai Mask unlocked
<6 7>Completist Mask unlocked
<7 7>Green Hero Mask unlocked
<8 7>Purple Hero Mask unlocked
<9 7>Master Mask unlocked
<10 7>Saur Mask unlocked
<11 7>Diving Mask unlocked
<12 7>Oonga Oonga Mask unlocked
<13 7>Officer Mask unlocked
<14 7>Mole Mask unlocked
<15 7>Digadig Mask unlocked
<16 7>Chieftain Mask unlocked
<17 7>BB Boy Mask unlocked
<18 7>BB Girl Mask unlocked
<19 7>Dinaurian Mask unlocked
<56 8>Possibly chapter number?
<59 8>Something to do with the mask shop
<62 8>Number of sonar upgrades left?
<67 8>Number of cleaning upgrades left?
<68 8>Number of case upgrades unlocked (1: 8, 2: 16, 3: 24, 4: 32, 5: 48, presumably 6: 64)
<3 9>Money (G)
<4 9>Current mask
<7 9>Player variant?
<9 9>Possibly number of fossil rocks?
<19 9>Donation points
<25 9>Number of fossils cleaned?
<30 9>Sonar monitor upgrade level
<31 9>Sonar fossil chip upgrade level
<32 9>Sonar fossil filter upgrade level
<30 10>Multiplayer unlocked
<33 10>Super Drill unlocked
<34 10>Hyper Hammer unlocked

  1. The most common example of this is dialogue choices, which have a 0-type in the DEX command, but an 8- or 9-type (usually) in the corresponding DEP condition