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 displayedDisplay 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 withBG_DISP
Background (Temp/CG)
: The index of a background to display asBG_DISPCG
; specify instead ofBackground
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 BGScroll 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 playingMode
: Whether to start or stop the musicVolume
: The volume of the BGM (0 is silent, 100 is max)Fade In Time (Frames)
: Time in frames that the BGM will fade inFade 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 isWhite Space End
: The space where the white piece should move toBlack Space Begin
: The space where a black piece to move isBlack 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 highlightPiece 2
: A space containing a piece whose potential moves to highlightPiece 3
: A space containing a piece whose potential moves to highlightPiece 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 clearedMiss Block
: Script block to go to if the chess game is failedMiss 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 emoteEmote
: 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 exitEnter/Exit
: Specifies whether the chibi is entering or exitingDelay (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 textSprite
: The character sprite to display when the dialogue is displayedSprite Entrance Transition
: Transition that makes the sprite enterSprite Exit/Move Transition
: Transition that makes the sprite exit or moves it aroundSprite Shake
: Applies a shaking effect to the spriteVoice Line
: The voice line to playText Voice Font
: The voice font to be applied when no voiced line is used, as defined by the dialogue config itemText Speed
: The speed at which the text is rendered, as defined by the dialogue config itemText Entrance Effect
: The effect to use as the text is printed to the screenSprite Layer
: Determines which "layer" a sprite should be rendered on entrance; higher numbers are rendered on top of lower onesDon't Clear Text
: If true, continues displaying the next dialogue line in the same boxNo 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:
Operator | Example | Effect |
---|---|---|
$num | $9 | Adjust the speed at which text appears on the screen; used to sync text with voice lines |
#Wnum | #W20 | Waits for a number of frames before continuing to show text on the screen |
#Pnum | #P5 | Changes 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 | #SE001 | Plays a sound effect as SND_PLAY |
#SK0 | #SK0Shake#sk | Shakes the text; terminated with #sk |
The colors available with the #P
operator:
Operator | Color |
---|---|
#P00 | Standard white text |
#P01 | Yellow text like in Kyon's monologue |
#P02 | Slightly off-white text |
#P03 | Gray-ish text |
#P04 | Lavendar text used for the Info speaker |
#P05 | Red, used for mentioning topics |
#P06 | Faded gray |
#P07 | Black |
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 clearSet
: 1 = set, 0 = clear
Sets or clears a flag.
GLOBAL2D
Parameters:
Value
: The value to set variableglobal2D
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 displayX
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 theINVEST_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:
Character | Variable |
---|---|
Haruhi | HFL |
Mikuru | MFL |
Nagato | NFL |
Koizumi | KFL |
Tsuruya | TFL |
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 paletteUnknown
: 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 theDIALOGUE
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 framesFade 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 fadesLocation
: The screen(s) the fade will be applied toColor
: Either black, white, or the custom color set by a previousSCREEN_FADEOUT
; this parameter must match that of the previousSCREEN_FADEOUT
call
Causes the screen to fade in.
SCREEN_FADEOUT
Parameters:
Fade Time (Frames)
: The length of the fade in framesFade 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 fadesCustom Color
: The color the fade will be ifColor
is set toCUSTOM
Location
: The screen(s) the fade will be applied toColor
: Either black, white, or the custom color defined byCustom Color
; this parameter must match that of the subsequentSCREEN_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 framesHold Time (Frames)
: Time to hold on the flash color in framesFade Out Time (Frames)
: Time for the fade out portion of the flash in framesColor
: 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 directionVertical 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 presentedOption 2
: The second choice to be presentedOption 3
: The third choice to be presentedOption 4
: The fourth choice to be presentedunknown08
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 notPlace
: 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 fromsnd.bin
Mode
: Whether to start or stop the soundVolume
: The volume of the soundCrossfade 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 checkScript 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.