List of Script Variables

From SkyTemple
Revision as of 18:55, 17 January 2024 by Frostbyte (talk | contribs) (Document SCENARIO_BALANCE_FLAG (value changes info by Gala1D))

This page lists all the variables available on the scripting engine. They can be read or written to from scripts.

Some variables store a single value, whereas others can store multiple bitflags.

List of variables

0x0 - VERSION

Seems to be used to keep track of save file versions. It's stored in the save file when the game is saved. When loading a save file, if the version value in it doesn't match the value of this variable, the save file is deleted.

0x1 - CONDITION

0x2 - SCENARIO_SELECT

0x3 - SCENARIO_MAIN

0x4 - SCENARIO_SIDE

0x5 - SCENARIO_SUB1

0x6 - SCENARIO_SUB2

0x7 - SCENARIO_SUB3

0x8 - SCENARIO_SUB4

0x9 - SCENARIO_SUB5

0xa - SCENARIO_SUB6

0xb - SCENARIO_SUB7

0xc - SCENARIO_SUB8

0xd - SIDE02_TALK

0xe - SIDE06_ROOM

0xf - SIDE08_BOSS2ND

0x10 - SIDE01_BOSS2ND

0x11 - SCENARIO_MAIN_BIT_FLAG

0x12 - SCENARIO_TALK_BIT_FLAG

0x13 - SCENARIO_BALANCE_FLAG

Starts at 0 and gets increased as the player completes certain story events. Controls bag size and the spawn threshold value of pokémon, which restricts spawning of some species until this variable reaches a certain value.

Value changes

This table lists the exact story spots where the value of the flag is increased.

Flag value Story chapter Story event Scene Script
0 1 Start of a new game - -
1 3 End of chapter V03P12A m03a1314.ssb
2 6 Expedition members are announced G01P04A m08a0301.ssb
3 9 End of chapter P04P01C m10a1213.ssb
4 13 End of chapter V16P02A m16a0702.ssb
5 15 End of chapter V19P06A m19b1014.ssb
6 Post-game 1 After graduating and moving to Sharpedo Bluff H02P99A s01p1103.ssb
7 Game complete The Ursarings tell Hero and Partner they can evolve

(After unlocking Marine Resort)

T01P01A m00p1401.ssb

Bag size

This table lists the maximum bag size depending on the current value of SCENARIO_BALANCE_FLAG.

Flag value Bag size
0 16
1 24
2 32
3 40
4 40
5 40
6 48
7 48

Values higher than 7 will read garbage data and cause crashes.

If PERFORMANCE_PROGRESS_FLAG[2] is 0, the bag will only have 1 slot, regardless of the value of SCENARIO_BALANCE_FLAG.

0x14 - SCENARIO_BALANCE_DEBUG

0x15 - CRYSTAL_COLOR_01

Used to keep track of the current color of the first crystal during the Crystal Cave puzzle.

0x16 - CRYSTAL_COLOR_02

Used to keep track of the current color of the second crystal during the Crystal Cave puzzle.

0x17 - CRYSTAL_COLOR_03

Used to keep track of the current color of the third crystal during the Crystal Cave puzzle.

0x18 - COMPULSORY_SAVE_POINT

0x19 - COMPULSORY_SAVE_POINT_SIDE

0x1a - SCENARIO_SELECT_BACKUP

0x1b - SCENARIO_MAIN_BIT_FLAG_BACKUP

0x1c - GROUND_ENTER

0x1d - GROUND_ENTER_LINK

0x1e - GROUND_GETOUT

0x1f - GROUND_MAP

0x20 - GROUND_PLACE

0x21 - GROUND_ENTER_BACKUP

0x22 - GROUND_ENTER_LINK_BACKUP

0x23 - GROUND_GETOUT_BACKUP

0x24 - GROUND_MAP_BACKUP

0x25 - GROUND_PLACE_BACKUP

0x26 - DUNGEON_SELECT

0x27 - DUNGEON_ENTER

0x28 - DUNGEON_ENTER_MODE

0x29 - DUNGEON_ENTER_INDEX

0x2a - DUNGEON_ENTER_FREQUENCY

0x2b - DUNGEON_RESULT

0x2c - GROUND_START_MODE

0x2d - DUNGEON_ENTER_BACKUP

0x2e - DUNGEON_ENTER_MODE_BACKUP

0x2f - DUNGEON_ENTER_INDEX_BACKUP

0x30 - DUNGEON_ENTER_FREQUENCY_BACKUP

0x31 - DUNGEON_RESULT_BACKUP

0x32 - GROUND_START_MODE_BACKUP

0x33 - REQUEST_CLEAR_COUNT

0x34 - PLAYER_KIND

0x35 - ATTENDANT1_KIND

0x36 - ATTENDANT2_KIND

0x37 - PLAYER_KIND_BACKUP

0x38 - ATTENDANT1_KIND_BACKUP

0x39 - ATTENDANT2_KIND_BACKUP

0x3a - FRIEND_SUM

0x3b - UNIT_SUM

0x3c - CARRY_GOLD

Stores the current amount of money carried by the player.

0x3d - BANK_GOLD

Stores the current amount of money stored in Duskull's bank.

0x3e - HERO_FIRST_KIND

0x3f - HERO_FIRST_NAME

0x40 - PARTNER_FIRST_KIND

0x41 - PARTNER_FIRST_NAME

0x42 - HERO_TALK_KIND

0x43 - PARTNER_TALK_KIND

0x44 - RANDOM_REQUEST_NPC03_KIND

0x45 - CONFIG_COLOR_KIND

0x46 - ROM_VARIATION

0x47 - LANGUAGE_TYPE

0x48 - GAME_MODE

Keeps track of the current game mode.

ID Mode
0 Top menu
1
2 Normal play, including overworld and dungeons
3 Special episode
4 Rescue
5

There might be more valid values.

0x49 - EXECUTE_SPECIAL_EPISODE_TYPE

0x4a - SPECIAL_EPISODE_TYPE

0x4b - SPECIAL_EPISODE_OPEN

0x4c - SPECIAL_EPISODE_OPEN_OLD

0x4d - SPECIAL_EPISODE_CONQUEST

0x4e - PERFORMANCE_PROGRESS_LIST

List of flags used to keep track of unlocked features and achievements. See Performance Progress Flags for the full list.

0x4f - DUNGEON_OPEN_LIST

List of unlocked dungeons. One bit per dungeon ID.

0x50 - DUNGEON_ENTER_LIST

0x51 - DUNGEON_ARRIVE_LIST

0x52 - DUNGEON_CONQUEST_LIST

List of completed dungeons. One bit per dungeon ID.

0x53 - DUNGEON_PRESENT_LIST

0x54 - DUNGEON_REQUEST_LIST

0x55 - WORLD_MAP_MARK_LIST_NORMAL

0x56 - WORLD_MAP_MARK_LIST_SPECIAL

0x57 - WORLD_MAP_LEVEL

0x58 - POSITION_X

0x59 - POSITION_Y

0x5a - POSITION_HEIGHT

0x5b - POSITION_DIRECTION

0x5c - EVENT_LOCAL

0x5d - DUNGEON_EVENT_LOCAL

0x5e - STATION_ITEM_STATIC

0x5f - STATION_ITEM_TEMP

0x60 - DELIVER_ITEM_STATIC

0x61 - DELIVER_ITEM_TEMP

0x62 - BIT_FUWARANTE_LOCAL

0x63 - LOTTERY_RESULT

0x64 - ITEM_BACKUP

0x65 - ITEM_BACKUP_KUREKURE

0x66 - ITEM_BACKUP_TAKE

0x67 - ITEM_BACKUP_GET

0x68 - REQUEST_THANKS_RESULT_KIND

0x69 - REQUEST_THANKS_RESULT_VARIATION

0x6a - SUB30_TREASURE_DISCOVER

0x6b - SUB30_SPOT_DISCOVER

0x6c - RECYCLE_COUNT

0x6d - SUB30_SPOT_LEVEL

0x6e - TEAM_RANK_EVENT_LEVEL

0x6f - PLAY_OLD_GAME

True if the player answered yes to the question on the personality quiz that asks if you played Explorers of Time or Darkness. Increases the recruit rate of certain pokémon if you haven't recruited them yet.

0x70 - NOTE_MODIFY_FLAG

0x71 - SUB30_PROJECTP

0x72 - SUM