Commands

The following document explains what every command in the game does.

Notes

  • Time in these commands is always defined in terms of frames. The game assumes a frame is 1/30 of a second, i.e. 30 frames per second. Thus, to wait one second, one would WAIT for 30 frames.

AVOID_DISP

Parameters: None

Displays the "Main Topic -> Avoid" graphics.

BACK

Parameters: None

When used in the initial script section, starts execution to the first script block. Otherwise, makes the script return to whatever called it (e.g. the puzzle phase) or returns you to the investigation phase.

BG_DISP

Parameters:

  • Background: The background to be displayed

Displays a background image on the lower screen. The background image can only be of type TEX_BG.

BG_DISP2

While this is listed as a separate command, it uses the same routine as BG_DISP.

BG_DISPCG

Parameters:

  • Background: The CG background to be displayed
  • Display from Bottom: If true, displays the bottom of a tall background (TEX_CG_SINGLE); if false, displays the top

BG_DISPCG works as BG_DISP but can display a larger variety of textures – namely, TEX_CG, TEX_CG_DUAL_SCREEN, TEX_CG_WIDE, and TEX_CG_SINGLE BGs. Notably, these are all CGs as opposed to VN backgrounds. Before displaying a standard BG after calling BG_DISPC, one should call BG_REVERT.

BG_FADE

Parameters:

  • Background: The background to display as with BG_DISP
  • Background (Temp/CG): The index of a background to display as BG_DISPCG; specify instead of Background
  • Fade Time (Frames): The time to fade in frames

Like the other BG display commands but crossfades the background rather than just displaying it.

BG_REVERT

Parameters: None

Reverts the background to the last call of BG_DISP (i.e. undoes any BG_FADE or BG_DISPCG calls). This is required before returning to displaying standard TEX_BG BGs. Note that if reverting a TEX_CG_DUAL_SCREEN BG, SET_PLACE must have been used to set the place location and have it displayed.

BG_REVERT does something odd to previously displayed CGs that makes attempting to display them again after the BG_REVERT crash/freeze/soft lock the game. If you need to go back and forth between the same CGs, consider using BG_FADE.

BG_SCROLL

Parameters:

  • Scroll Direction: The direction to scroll the BG
  • Scroll Speed: Speed at which to scroll (1 is a good default)

When a background that is larger than the screen is shown (such as TEX_CG_DUAL_SCREEN, TEX_CG_WIDE, and TEX_CG_SINGLE), scrolls the background in a DEFINED direction.

BGM_PLAY

Parameters:

  • Music: The background music to start or stop playing
  • Mode: Whether to start or stop the music
  • Volume: The volume of the BGM (0 is silent, 100 is max)
  • Fade In Time (Frames): Time in frames that the BGM will fade in
  • Fade Out Time (Frames): Time in frames that the BGM will fade out

Plays or stops background music.

CHESS_CLEAR_ANNOTATIONS

Parameters: None

Clears all chessboard annotations. Unused.

CHESS_LOAD

Parameters:

  • Chess File: The chess file to load

Loads a chess file into memory and (if the chess overlay is loaded) places it on the chessboard.

CHESS_MOVE

Parameters:

  • White Space Begin: The space where a white piece to move is
  • White Space End: The space where the white piece should move to
  • Black Space Begin: The space where a black piece to move is
  • Black Space End: The space where the black piece should move to

Moves a piece (or pieces) on the chessboard.

CHESS_RESET

Parameters: None

Resets the chessboard to its original state.

CHESS_TOGGLE_CROSS

Parameters:

  • Cross Space 0-15: The spaces to place/remove a cross on

Crosses out spaces on the chessboard with a red X. If a space is already crossed out, this command uncrosses it out.

CHESS_TOGGLE_GUIDE

Parameters:

  • Piece 1: A space containing a piece whose potential moves to highlight
  • Piece 2: A space containing a piece whose potential moves to highlight
  • Piece 3: A space containing a piece whose potential moves to highlight
  • Piece 4: A space containing a piece whose potential moves to highlight

Highlights the potential moves of a piece in red. If a piece has already been highlighted, this command unhighlights it.

CHESS_VGOTO

Parameters:

  • Clear Block: Script block to go to if the chess game is cleared
  • Miss Block: Script block to go to if the chess game is failed
  • Miss 2 Block: Script block to go to if the chess game is failed in some unused way

Monitors for the end of the chess game and then jumps to a specified script block depending on the outcome.

CHESS_TOGGLE_HIGHLIGHT

Parameters:

  • Highlight Space 0-15: The spaces to highlight

Highlights spaces on the chessboard in yellow. If a space is already highlighted, this command unhighlights it.

CHIBI_EMOTE

Parameters:

  • Chibi: The chibi to emote
  • Emote: The emote that should be shown

This command displays an emote in a speech bubble above a chibi figure on the top screen.

CHIBI_ENTEREXIT

Parameters:

  • Chibi: Specifies the chibi to enter or exit
  • Enter/Exit: Specifies whether the chibi is entering or exiting
  • Delay (Frames): Specifies the number of frames after which the chibi should enter or exit

Specifies a chibi figure to enter or exit the top screen. To be used by this command, a chibi must have a walk cycle (animation 01) in addition to its default idle animation (animation 00).

CONFETTI

Parameters:

  • Visible: If true turns confetti on. If false, turns it off.

Displays falling confetti on the top screen.

DIALOGUE

Parameters:

  • Dialogue: The dialogue line, composed of a speaker and the dialogue text
  • Sprite: The character sprite to display when the dialogue is displayed
  • Sprite Entrance Transition: Transition that makes the sprite enter
  • Sprite Exit/Move Transition: Transition that makes the sprite exit or moves it around
  • Sprite Shake: Applies a shaking effect to the sprite
  • Voice Line: The voice line to play
  • Text Voice Font: The voice font to be applied when no voiced line is used, as defined by the dialogue config item
  • Text Speed: The speed at which the text is rendered, as defined by the dialogue config item
  • Text Entrance Effect: The effect to use as the text is printed to the screen
  • Sprite Layer: Determines which "layer" a sprite should be rendered on entrance; higher numbers are rendered on top of lower ones
  • Don't Clear Text: If true, continues displaying the next dialogue line in the same box
  • No Lip Flap: Manually disables lip flaps for dialogue that would otherwise have them

Displays a line of dialogue and/or manipulates character sprites. Can optionally play a voiced line.

A couple of notes on sprites:

  • Sprites are associated with a speaker
  • Sprites will not be displayed unless the first sprite is given an entrance transition
  • After the first sprite is displayed for a speaker, other sprites of that speaker can be switched to without entrance transitions
  • Sprites will not exit unless the sprite is specified with an exit transition

For dialogue, there are a number of operators available that have different effects:

OperatorExampleEffect
$num$9Adjust the speed at which text appears on the screen; used to sync text with voice lines
#Wnum#W20Waits for a number of frames before continuing to show text on the screen
#Pnum#P5Changes the color of the text; the available colors can be seen in the table below
#DP#DP"Dialogue placeholder," doesn't have much of a function
#SEnum#SE001Plays a sound effect as SND_PLAY
#SK0#SK0Shake#skShakes the text; terminated with #sk

The colors available with the #P operator:

OperatorColor
#P00Standard white text
#P01Yellow text like in Kyon's monologue
#P02Slightly off-white text
#P03Gray-ish text
#P04Lavendar text used for the Info speaker
#P05Red, used for mentioning topics
#P06Faded gray
#P07Black

EPHEADER

Parameters:

  • Episode Header: The index of the title texture to use, i.e. 1 = Episode 1, 2 = Episode 2, 3 = Episode 3, 4 = Episode 4, 5 = Episode 5, 6 = Epilogue (if you want to be really clever, -1 is the main menu title)

Sets the upper screen to be an episode title texture.

FLAG

Parameters:

  • Flag: The flag to set or clear
  • Set: 1 = set, 0 = clear

Sets or clears a flag.

GLOBAL2D

Parameters:

  • Value: The value to set variable global2D to

Sets a global variable to a specified value. Only used in one place so it's difficult to determine what it affects.

GOTO

Parameters:

  • Script Section: The section to jump to

Jumps to a particular script section.

HARUHI_METER

Parameters:

  • Add: The value to add to the Haruhi Meter (positive values move the meter toward Distracted while negative values move it toward Focused)
  • Set: The value to set the Haruhi Meter at (does not show the meter)

Modifies the value of the Haruhi Meter. The meter minimum is 0 (corresponding to 10%) and the meter maximum is 9 (corresponding to 100%).

HARUHI_METER_NOSHOW

Parameters:

  • Add: The value to add to the Haruhi Meter

Adds to the Haruhi Meter without showing the Haruhi Meter UI (the sound effects are still played). Unused in the game.

HOLD

Parameters: None

Stops script execution until input is received from the player.

INIT_READ_FLAG

Parameters: None

Unknown, unused in the game.

INVEST_END

Parameters: None

Ends investigation mode and returns to the main visual novel format of the game. Automatically fades screen to black.

ITEM_DISPIMG

Parameters:

  • Item: The item to display
  • X
  • Y

Displays the specified item image. Under certain circumstances, this should work; however, it seems this soft locks the game most of the time. Unused.

INVEST_START

Parameters:

  • unknown00
  • unknown01
  • unknown02
  • unknown03
  • End Script Section: The script section that starts with the INVEST_END command.

Starts investigation mode. Automatically fades screen in from black.

KBG_DISP

Parameters:

  • "Kinetic" Background: The "kinetic" background to display on the top screen

Displays a particular "kinetic" (my word) background on the top screen. Must be of type KINETIC_SCREEN.

LOAD_ISOMAP

Parameters:

  • Map: The map to load

Loads an isometric map for usage by INVEST_START.

MODIFY_FRIENDSHIP

Parameters:

  • Character: The character to modify: Haruhi, Mikuru, Nagato, Koizumi or Tsuruya.
  • Modify By: The value to modify the friendship level by for the selected character

Modifies a character's "Friendship Level" by adding a particular value to it. The value can be positive or negative. Friendship levels start at 1 and persist throughout a playthrough. They can be referenced in conditionals with the following variable names:

CharacterVariable
HaruhiHFL
MikuruMFL
NagatoNFL
KoizumiKFL
TsuruyaTFL

NEXT_SCENE

Parameters: None

Ends the scene and moves to the next one as listed in the Scenario item.

NOOP1

Parameters: None.

Does nothing.

NOOP2

Parameters: None.

Does nothing.

NOOP3

Parameters: None.

Does nothing.

OP_MODE

Parameters: None

Suppresses the top screen UI, disables dialogue skipping, and marks the center of the screen as the position the Kyon chibi walks to, and sends the Kyon chibi out. Used only in the opening text crawl.

PALEFFECT

Parameters:

  • Mode: The palette effect to be applied (available effects are default, inverted, grayscale, sepia, and dimmed)
  • Time (Frames): The time in frames that the BG's palette will take to switch to transition to the effect palette
  • Unknown: This clearly does things when looking at the assembly/decomp, but I don't know what it's doing precisely

PIN_MNL

Parameters:

  • Dialogue: Dialogue line as in the DIALOGUE command

Draws a dialogue line as monologue over all other dialogue. Undone by completing a chess game.

REMOVED

Removed in the final version of the game (not referenced in any scripts.)

SCENE_GOTO

Parameters:

  • Scene: Name of the script file to go to

Goes to a particular scene. Note that this scene cannot be just any script file; it must be contained within a special array in ARM9 itself; thus, ROM hacks may decide to change the location of this array.

SCENE_GOTO2

Parameters:

  • Scene: Name of the script file to go to

Behaves as SCENE_GOTO, except this command does not clear a flag before jumping. Otherwise, they seem to be identical.

SCREEN_FADEIN

Parameters:

  • Fade Time (Frames): The length of the fade in frames
  • Fade In Percentage: The percentage of darkness to fade into (where 0 is fully bright and 100 is fully dark; e.g. 50 means the screen will be 50% darker than full brightness when the fade in is complete); only respected by custom color fades
  • Location: The screen(s) the fade will be applied to
  • Color: Either black, white, or the custom color set by a previous SCREEN_FADEOUT; this parameter must match that of the previous SCREEN_FADEOUT call

Causes the screen to fade in.

SCREEN_FADEOUT

Parameters:

  • Fade Time (Frames): The length of the fade in frames
  • Fade out Percentage: The percentage darkness to fade into (where 0 is fully bright and 100 is fully dark; e.g. 50 means that the screen will be 50% brighter than full black when the fade is complete); only respected by color fades
  • Custom Color: The color the fade will be if Color is set to CUSTOM
  • Location: The screen(s) the fade will be applied to
  • Color: Either black, white, or the custom color defined by Custom Color; this parameter must match that of the subsequent SCREEN_FADEIN call

Causes the screen to fade out.

SCREEN_FLASH

Parameters:

  • Fade In Time (Frames): Time for the fade in portion of the flash in frames
  • Hold Time (Frames): Time to hold on the flash color in frames
  • Fade Out Time (Frames): Time for the fade out portion of the flash in frames
  • Color: The color of the flash

Flashes the screen a specified color for a specified amount of time.

SCREEN_SHAKE

Parameters:

  • Duration (Frames): Effect duration in frames (if -1, shakes indefinitely)
  • Horizontal Intensity: Intensity of the shake in the horizontal direction
  • Vertical Intensity: Intensity of the shake in the vertical direction

Shakes the bottom screen.

SCREEN_SHAKE_STOP

Parameters: None

Stops screen shaking from a SCREEN_SHAKE command. (Used when the Duration parameter of said SCREEN_SHAKE is set to -1).

SELECT

Parameters:

  • Option 1: The first choice to be presented
  • Option 2: The second choice to be presented
  • Option 3: The third choice to be presented
  • Option 4: The fourth choice to be presented
  • unknown08
  • unknown0A
  • unknown0C
  • unknown0E

Presents the player with a series of choices that branch the dialogue tree. Choices are defined in their own section and have IDs that correspond to labels set in the labels section. When a choice is chosen, this ID is used to select which script block will be jumped to.

SELECT cannot be used in the initial, unnamed script block.

SET_PLACE

Parameters:

  • Display?: Whether to display the location graphic or not
  • Place: The place to display

Modifies the displayed place name.

SKIP_SCENE

Parameters:

  • Scenes to Skip: Number of scenes that should be skipped

Sets up the NEXT_SCENE command to skip a specified number of scenes as defined in SCENARIO.S (evt.bin #580).

SND_PLAY

Parameters:

  • Sound: The sound to be played from snd.bin
  • Mode: Whether to start or stop the sound
  • Volume: The volume of the sound
  • Crossfade Time (Frames): Time in frames that the sound will crossfade; only can be used when changing the volume of the same sound

Plays a sound from the SDAT snd.bin.

STOP

Parameters: None

Stops script execution and soft locks the game. Unused.

TOGGLE_DIALOGUE

Parameters:

  • Show: Whether to show the dialogue box or not

Shows/hides the dialogue box. Note that plenty of other commands already do one of these (e.g., DIALOGUE automatically shows the dialogue box).

TOPIC_GET

Parameters:

  • Topic: The topic to give the player

Give the player a particular topic.

TRANS_OUT

Parameters:

  • Transition: The transition to use

Plays a transition to black.

TRANS_IN

Parameters:

  • Transition: The transition to use

Plays a transition from black into the scene.

UNKNOWN0A

Parameters: None

Unused in the game, unknown what this does.

VCE_PLAY

  • Voice Line: The voiced line to play

Plays a voice file.

VGOTO

Parameters:

  • Conditional: The conditional to check
  • Script Section: The script section to jump to

Goes to a specified script section if a specified conditional is true.

WAIT

Parameters:

  • Time (Frames): The number of frames to wait

Waits a particular number of frames.

WAIT_CANCEL

Parameters:

  • Time (Frames): The number of frames to wait.

A command nearly identical to WAIT, but allows for the wait to be canceled with a button press or screen tap.