CCScript Command Documentation - pk-hack/CoilSnake GitHub Wiki
About
This document contains information about every command available in EarthBound's text script system. As well as the text itself, the script system contains "commands" or "control codes", which handle control flow, events, and dynamic data such as player character names.
Format and terminology
Because this document is written mostly for ROM hacking, and most ROM hacking uses the CCScript format, the term "command" will be used to refer to the non-text script functions documented here. "Control code" will be reserved specifically to refer to their form as compiled bytes of the script. Commands in the MSG format, used by the original developers, will also be documented for the sake of historical interest.
The original standard library provided with the CCScript compiler is incomprehensive and contains some confusing terminology. Current best practice is to use stdext.ccs by PhoenixBound in combination with the standard library. This documentation uses the command macros defined there.
This documentation is split into three main sections: the Command list, the Command macro list, and the ROM access macro list. The first section documents commands that map 1:1 with control codes. The second section documents commands that expand into several other commands. The third section documents commands to modify ROM data both tabulated and hardcoded.
Registers
EarthBound's script system comes with three registers to store data in. These registers are local to each window, can be backed up and restored locally, and backed up and restored globally. They are:
Result: This register is often filled by the return values of commands, and is also used for control flow. Sometimes it also has similar purpose to the argument register. Otherwise known as "working memory" or "main register". It is 32 bits wide.
Argument: This register is read from instead when passing a value of zero to some commands. As such, it forms the basis for passing arguments from the registers to commands. Otherwise known as "argumentary memory" or "sub register". It is 32 bits wide.
Counter: This register is somewhat more limited, but has the unique ability to be incremented. By incrementing and checking it, simple loops can be formed. Otherwise known as "secondary memory" or "loop register". It is only 16 bits wide. Its global backup is only 8 bits wide; any data above this will be lost when making the global backup.
How to read command documentation
There are 239 commands defined in the standard library and stdext together. In this document, they're ordered the same as their control code values in the game. It may be helpful to jump to the table of contents at the end of the page.
Command documentation comes with a name, a short description, one to three tables, and an extended description. The first table will always be present, and contains information about the command's format. The second table summarises arguments if applicable. The third table summarises return values if applicable. A visual description below:
example_command - Short description of the command
CCS
MSG
Control code
ccscript_format(arg1, arg2) some_alias
@MSG_FORMAT(arg1, arg2)
AB CD XX YY YY ZZ ZZ ZZ ZZ
Argument
Data length
Description
Behaviour if zero
argumentname
length
Short description of argument and/or link to glossary
Special behaviour where relevant
Return location
Description
Register name or other memory
Short description of the return value and/or link to glossary
Detailed description of the command, including information about arguments, effects, and return values.
Argument and return value glossary
Many commands take arguments or return values with common formats. There are also some constant definitions in the standard library that can be used anywhere. Standard-library constants that are relevant across many commands are listed here; others that are specific to only one command will be documented alongside the command.
Directions
A value specifying one of 8 directions. Starts at up and heads clockwise: 1 is up, 2 is up-right, 3 is right, etc. Values are:
Value
Definition
Description
1
NORTH
Up / North
2
NORTHEAST
Up-right / Northeast
3
EAST
Right / East
4
SOUTHEAST
Down-right / Southeast
5
SOUTH
Down / South
6
SOUTHWEST
Down-left / Southwest
7
WEST
Left / West
8
NORTHWEST
Up-left / Northwest
Flags
A value which can be set to 1 or 0 for "true" or "false". There are 1024 of these available in vanilla EarthBound, about 970 of which are employed by the game. They have no intrinsic effect; what they "do" depends on what checks the flag and does in response.
Labels and addresses
A pointer to more text data. This is either a label (CCScript identifier, mymodule.mylabel) or an address (hexadecimal, 0xC0FFEE). Where mentioned, using 0 in place of one of these indicates that no script should be called or goto'd.
Party member IDs
A party member. 1 is Ness, 2 is Paula, 3 is Jeff, 4 is Poo. If you need a script to be responsive to the current party state, use get_char_at_pos. Where mentioned, a value of -1 indicates that the operation should apply to either the entire party or the first applicable member.
NPC IDs
An NPC as it appears in npc_configuration_table.yml or in the map editor. Remember that the placement of NPCs is separate from the NPC data itself.
Sprite IDs
A sprite as it appears in the SpriteGroups folder and sprite_groups.yml.
Item IDs
ID of an item as it appears in item_configuration_table.yml.
Actionscript IDs
ID of an Actionscript as it appears in a table not yet decompiled by CoilSnake. However, movement_reloc.ccs contains all the addresses of the vanilla ones and supports adding your own.
Window IDs
The ID of a window as defined in window_configuration_table.yml. Only one instance of each window may be open at a time, so these IDs are used to keep track of them.
PSI Teleport destination IDs
A destination for PSI Teleport. These are defined in psi_teleport_destination_table.yml and can be edited in EBME's "Warp & TP" map editor mode.
Inventory slots
A position of an item in a character's inventory. 1 is the top-left-most slot, 2 is the top-right-most slot, 3 and 4 are the same but the next row down, etc. Party members can carry 14 items each. Escargo Express also has its own inventory of 36 items.
Status groups and effects
Statuses effects are sorted into groups, of which only one status effect can be active at a time. When inflicting another status within a group, the lower ID takes priority. They are as follows:
Can affect anyone even though usually only Ness gets it
7
Shields
1. PSI power shield 2. PSI shield 3. Power shield 4. Shield
Goes away after battle
Letters
The encoded form of a letter. This is the same as ASCII encoding, but raised by 0x30 (ie. "a" is ASCII 0x61 and EB encoding 0x91). Another easy way to look at this is the font graphics: the row is the first hex digit (starting at 5) and the column is the second digit.
Appearance styles
A visual effect animation applied to a sprite when it is created or deleted. Values are:
Value
Definition
Description
Animation
1
APPEAR
Instantly appear
2
APPEAR_BLINK
Blink, starting fast, and then going slow
3
APPEAR_HORZ
Appear with interlaced horizontal lines
4
APPEAR_VERT
Appear with interlaced vertical lines
5
APPEAR_SPRAY
Appear with a spray effect
6
(No definition)
Instantly disappear
7
APPEAR_FASTBLINK
Blink, starting fast, and then going slow. Despite name, seems identical to APPEAR_BLINK
8
VANISH_HORZ
Disappear with interlaced horizontal lines
9
VANISH_VERT
Disappear with interlaced vertical lines
10
VANISH_SPRAY
Disappear with a spray effect
-1
(No definition)
For entity creation only; queue to instantly appear after the next screen transition
The blinking animations modify the visibility of the entity directly, so its visibility beforehand does not matter. For others, the entity should be visible before starting the animation. In the case of creating new entities, the best results are achieved by waiting two frames in its Actionscript before setting the direction and animation frame.
Floating emotes
Temporary entities that are created and automatically positioned near another specified entity, usually to express some kind of emote. Their values are:
All operations that act on Actionscript entities will only operate on the first one found in the internal list of loaded entities unless otherwise mentioned. Behaviour when none are found depends on the command. Party members are always after everything else in this list, but other ordering is largely unpredictable.
As stdext is backwards-compatible, it has to respect some of the poor naming conventions of the original standard library. The most major of these is using the term "sprite" to refer to NPCs in command names. Therefore, stdext uses "sprite2" to refer to sprites, and the word "sprite" is reserved for legacy commands (they have received updated aliases). This only applies to command names: "sprite" will not refer to NPCs or entities in general throughout the rest of the documentation; only sprite IDs.
In control code documentation, arguments will be represented by sets of XX, YY, ZZ, AA... for the amount of bytes that they each take up, instead of a name. They correspond to the CCScript command arguments in the same order.
CCScript almost always uses 1-indexed values instead of 0-indexed, as 0 usually causes a register's value to be used instead, or indicates a null return value.
Moves text printing to the following line. This will start a new line even if the current line is blank. To only start a new line if the current line is not blank, use newline.
newline - Line break if not blank
CCS
MSG
Control code
newline
←
01
Moves text printing to the following line only if the current line is not blank (ie. the text cursor is not at X position 0). To always begin a new line, use linebreak.
eob - End of block
CCS
MSG
Control code
eob
』 @!
02
Marks the end of a text block, returning to the caller if it was called or ending text parsing altogether if at the top of the call stack. Restores the state of the text processor backed up by back_up_text_rendering_state.
promptw - Weak prompt (wait for input with blinking triangle)
CCS
MSG
Control code
promptw
@KEY()
03
When outside of battle, acts the same as prompt. When in battle, the effect varies based on the player's chosen text speed:
Medium or Fast: Halts for a brief moment before automatically continuing.
Slow: Displays the blinking triangle and awaits a button press.
To always display the blinking triangle in battle, use prompt instead.
Moves text parsing to the location of target. Parses text there until an eob is reached, then returns and continues. This is commonly used to construct subroutines, with the registers used for passing arguments when necessary. The call stack is 10 frames deep; going deeper than this will cause the stack to wrap around.
switch_goto - Go to location based on result register
CCS
MSG
Control code
switch_goto(num)
@ONGOTO(...)
09 XX
Argument
Data length
Description
Behaviour if zero
num
byte
Maximum expected value of result register
(Result register)
N/A
Switch statement jump index
Begin a switch statement. This should be followed by num instances of switch_entry. Based on the result register, one of the switch_entry locations will be jumped to in the same manner as goto (ie. if the result register is 1, the first entry will be jumped to, if it is 2, the second entry will be jumped to, etc). This usually follows menu selections. If the result register is 0 or greater than num, nothing will happen.
An entry for switch_goto and switch_call. This should be included the appropriate amount of times after those commands. A location will be chosen based on the result register.
This command is not an actual control code, rather a consequence of CCScript not supporting variadic arguments. In the MSG format, the entries are included directly in the switch statement, and the appropriate number of entries is interpreted by the compiler.
Compares the value of the result register to the provided value num, and returns 1 if they match. If they do not match, it returns 0.
result_not - Result register not equal to
CCS
MSG
Control code
result_not(num)
@NOT(num)
0C XX
Argument
Data length
Description
Behaviour if zero
num
byte
Value to compare
Argument register
Return location
Description
Result register
Result of the comparison (0 or 1)
Compares the value of the result register to the provided value num, and returns 0 if they match. If they do not match, it returns 1.
rtoarg - Copy result register to argument register
CCS
MSG
Control code
rtoarg
@SET_REG(0)
0D 00
Return location
Description
Argument register
Value of the result register
Copies the value of the result register to the argument register. Overwrites whatever is in the argument register, and does not modify the result register.
ctoarg - Copy counter register to argument register
CCS
MSG
Control code
ctoarg
@SET_REG(1)
0D 01
Return location
Description
Argument register
Value of the counter register
Copies the value of the counter register to the argument register. Overwrites whatever is in the argument register, and does not modify the counter register.
counter - Set value of counter register
CCS
MSG
Control code
counter(num)
@SET_LOOPREG(num)
0E XX
Argument
Data length
Description
Behaviour if zero
num
byte
Desired value
Argument register
Return location
Description
Counter register
Provided value
Sets the counter register to value num. Note that this cannot reliably be used on its own to set the value of the counter register to zero, as providing zero reads from the argument register. Instead, ensure that the argument register is zero first, and then use this command, or use counter_zero.
inc - Increment value of counter register
CCS
MSG
Control code
inc
@INC()
0F
Return location
Description
Counter register
Value of the counter register increased by one
Increments the value in the counter register by one. This is commonly used to construct simple loops of a fixed length.
pause - Pause text parsing temporarily
CCS
MSG
Control code
pause(len)
@WI(len)
10 XX
Argument
Data length
Description
Behaviour if zero
len
byte
Length to pause for in frames
Argument register
Pauses text parsing for len frames. Often simply used to create dramatic effect or natural flow in text printing. EarthBound runs at 60 frames per second, so pause(30) would pause for half a second. CCScript offers two shorthand aliases for this command: \ and |, which pause for 5 and 15 frames respectively.
do_menu - Execute selection menu
CCS
MSG
Control code
do_menu
@SELQ()
11
Return location
Description
Result register
Menu item chosen, or 0 if cancelled
Creates a cancellable selection menu with the strings loaded by load_str and load_str_callonhover. Returns the index of the menu item the player chose (starting from 1) or 0 if the player pressed B to cancel. Generally a switch_goto will be placed after this command to execute text associated with the selection.
clearline - Clear line
CCS
MSG
Control code
clearline
@CLRLINE()
12
Clears the text on the current line and moves the printing cursor back to the beginning of the line.
wait - Wait for input
CCS
MSG
Control code
wait
@KEYNP()
13
Waits for the player to press a button before continuing to parse text, without displaying the blinking triangle. This is commonly used at the end of dialogue, directly before a window_closeall (where needed) and an eob.
prompt - Wait for input with blinking triangle
CCS
MSG
Control code
prompt
@FKEY()
14
Waits for the player to press a button before continuing to parse text, and displays a blinking triangle in the bottom right of the window.
comp1 - Print text from compressed text block 1
CCS
MSG
Control code
comp1(entry)
N/A
15 XX
Argument
Data length
Description
Behaviour if zero
entry
byte
Entry in block 1 to print
Prints text of entry number entry from the first compressed text block. This is not commonly used in decompiled CCScript as the compiler contains no compression capabilities and the decompiled script is automatically decompressed. The MSG compiler presumably added it automatically during compilation.
comp2 - Print text from compressed text block 2
CCS
MSG
Control code
comp2(entry)
N/A
16 XX
Argument
Data length
Description
Behaviour if zero
entry
byte
Entry in block 2 to print
Similar to comp1, but for the second compressed text block.
comp3 - Print text from compressed text block 3
CCS
MSG
Control code
comp3(entry)
N/A
17 XX
Argument
Data length
Description
Behaviour if zero
entry
byte
Entry in block 3 to print
Similar to comp1, but for the third compressed text block.
window_closetop - Close the topmost text window
CCS
MSG
Control code
window_closetop
@CLOSE()
18 00
Closes the topmost window. Windows are moved to the top of the stack when they are opened or when text is being parsed in them.
Opens the window of ID id. Attempting to reopen an already opened window will raise and clear it.
back_up_text_rendering_state - Back up the current window's text rendering state
CCS
MSG
Control code
back_up_text_rendering_state
@SAVE_WIN()
18 02
Backs up the script context. Backed up information includes:
Currently focused window
Text-printing position
Number padding
Font
Colour
This information is automatically restored after reaching an eob in any circumstances, most usefully when returning from a called subroutine, executed menu item, or menu hover callback. If there is no currently-focused window, the data will not be backed up.
Upon restoring, if the backed-up focused window has since been closed, the data will not be restored.
One backup is kept per item in the script call stack, so using this command again within another subroutine will not cause its parent's backup to be overwritten.
Switches to the text window of ID id, transferring focus to it. If the window is not already open, undefined behaviour can occur when doing further actions such as printing text.
window_closeall - Close all text windows
CCS
MSG
Control code
window_closeall
@CLOSEALL()
18 04
Closes all open text windows. Usually precedes the beginning of battles and cutscenes. It's not necessary to use at the end of NPC dialogue, as windows will automatically be closed when done talking to them.
text_pos - Move the printing cursor
CCS
MSG
Control code
text_pos(x, y)
@LOC(x, y)
18 05 XX YY
Argument
Data length
Description
Behaviour if zero
x
byte
Position to move to, in pixels or tiles.
y
byte
Position to move to, in rows
Moves the printing cursor to location (x, y). y is measured in text-height rows of 16 pixels from the top of the window. x is measured in pixels from the left edge of the window, provided the value of RAM address $5E71 is nonzero, otherwise it is in tiles. The tile mode is off for most text printing, but is turned on in some menus such as the status screen.
window_clear - Clear text in current window
CCS
MSG
Control code
window_clear
@CLS()
18 06
Clears all text from the current window and moves the printing cursor to the top-left.
Result of the comparison. 0, 1, 2 for <, =, > respectively.
Compares the value num to a register. The argument register defines which to compare to: 0 for result, 1 for argument, and 2 for counter. CCScript also offers aliases for these in the form of compare_result(num), compare_argument(num), and compare_counter(num). As num is long, very large numbers can be compared with this command. This command returns 0 if num < register, 1 if num = register, and 2 if num > register.
do_menu_in_window_nocancel - Execute selection menu in window, not cancellable
Behaves similarly to do_menu, but first switches to the window of ID id, and the player cannot press B to cancel the menu. This window should be open before using this command.
This command is unused in the vanilla game, so the MSG format equivalent is unknown.
do_menu_in_window - Execute selection menu in window
Behaves similarly to do_menu, but first switches to the window of ID id. This window should be open before using this command.
open_wallet - Open wallet window
CCS
MSG
Control code
open_wallet show_wallet
@WINR_MONEY()
18 0A
Opens the wallet window and displays the cash on hand in it. This does not move focus into that window. The value displayed in the window will not be updated in real-time, but using this command when it is already open will refresh the value. CCScript offers show_wallet as an alias to this command.
Opens window 8 and displays the status of player character char in it, similar to using the Status option in the command window. The character does not need to be in the party. This will also move text parsing into window 8.
The final byte of the control code should always be 01. This appears to be removed extra functionality - 02 is checked for, but does nothing if found, and all other values do nothing.
This command is unused in the vanilla game, so the MSG format equivalent is unknown.
load_str - Load string for menu
CCS
MSG
Control code
load_str(str)
<str>
19 02 ... 02
Argument
Data length
Description
Behaviour if zero
str
Any
String to load
Prepares a string for use in a menu. The string should not contain any other commands, only text. In the MSG format, text strings are placed between angle brackets to use this command.
load_str_callonhover - Load string for menu with hover callback
This is similar to load_str, but includes the location of a callback script which is executed when this option is hovered by the menu selection cursor. The callback script may contain commands as well as text.
This command is unused in the vanilla game, so the MSG format equivalent is unknown. Any other hover callbacks, such as when selecting a window flavour, are done through code.
When writing a hover callback, the callback must return focus to the window with the menu. The easiest way to do this is to use back_up_text_rendering_state at the beginning of the callback; the eob will handle returning the focus.
Gets the ID of a player character based on their current position in the party. For example, if Ness is dead and Paula has become the party leader, get_char_at_pos(1) will return 2.
get_name_letter - Get a single letter from a character's name
Gets a single letter from a player character's name, based on the counter register. This can be printed with letter after using rtoarg or swap. Combine with a simple loop to do things like how Giygas brokenly says Ness's name.
get_next_storage_item - Get Escargo Express carrier item and increment counter register
Gets the item in Escargo Express carrier storage based on the value of the counter register. If there is no item, it returns 0. Also, the counter register is incremented by one when using this command.
Current inflicted status effect in the group for 0 if none
Gets the status in status group group that a player character is currently inflicted with. If they are not suffering from any status in the group, it will return 0. Only returns the status, not the group.
get_levelup_exp - Get player character experience to level up
Gets the amount of experience needed to reach the next level for player character char. Use number to print it. This is used when calling Dad over the phone.
Gets the amount of strings loaded by load_str or load_str_callonhover in window ID win. If win is 0, then the currently-focused window will be used instead.
queue_item - Queue item for Escargo Express pickup
CCS
MSG
Control code
queue_item(char, slot)
@SET_TRANS_GOODS(char, slot)
19 1C XX YY
Argument
Data length
Description
Behaviour if zero
char
byte
Party member to get item from. -1 for Escargo Express inventory
Removes an item from player character char's inventory at slot slot and adds it to Escargo Express carrier storage. If char is -1, Escargo Express inventory will be used instead. Up to three items can be queued at a time - adding any more will result in the item being lost.
get_queued_item - Get information about queued Escargo Express carrier item
CCS
MSG
Control code
get_queued_item(index) remove_queued_item(index)
@GET_TRANS_GOODS(index, remove)
19 1D XX YY
Argument
Data length
Description
Behaviour if zero
index
byte
Index from 1-3 of queued item
Result register
remove
byte
(Not in CCS) If nonzero, removes the item from the queue
Gets information about an item queued in Escargo Express carrier storage at index index. The result register is set to the original owner of the item (Party member value for players and -1 for Escargo Express itself) and the argument register is set to the item ID.
The second byte of the control code, if nonzero, will free the spot in the queue. CCScript does not expose this byte - use remove_queued_item instead.
get_delta - Get delta of last change
CCS
MSG
Control code
get_delta
@GET_CNUM()
19 1E
Return location
Description
Result register
Amount
Returns the delta of the last stat-changing effect. This includes things like dealing damage, healing, and even stat increases at level-up. There is also a shorthand way to print this: the delta command.
get_action_arg - Get argument of last battle action
CCS
MSG
Control code
get_action_arg
@GET_CITEM()
19 1F
Return location
Description
Result register
Argument of the last battle action
Returns the argument of the most recently-used battle action.
get_party_size - Get size of party
CCS
MSG
Control code
get_party_size
@GET_MEMBERS()
19 20
Return location
Description
Result register
Size of the party
Returns the current size of the party, ie, the amount of characters in it.
Find the direction from player character char to an object. The to_type determines what kind of object will be searched for. The obj is the ID of the object, with respect to what type it is. Undefined behaviour if either the source or target cannot be found.
get_dir_from_npc - Get direction from NPC to object
This command is intended to be used during a player's battle action. Given an item of ID item, searches that player's inventory for the first condiment. If the item is not a food item or there are no condiments in the player's inventory, 0 will be returned. This is used to print the name of the condiment to be used, not to apply its effect. If this is used outside of battle, the resuly may not be useful.
set_respawn_point - Set respawn point to current location
Sets the respawn point that the player will return to after a game over to the current location. teleport is the ID of a PSI Teleport destination, but goes unused, as the current location will be used instead. The argument is a remnant of the scrapped Teleport Box item.
get_stat - Get statistic
CCS
MSG
Control code
get_stat(stat)
(Unknown)
19 27 XX
Argument
Data length
Description
Behaviour if zero
stat
byte
Stat ID to check
Argument register
Return location
Description
Result register
Stat or pointer to stat
Gets the value of a statistic, or if the statistic is text, the three-byte pointer to that statistic. This goes unused in the vanilla game, so the MSG equivalent is unknown. Stats are:
Japanese player's name (MOTHER 2 remnant, Tony's question)
English player's name (MOTHER 2 remnant, Tenda Elder's question. This should be used when printing the player's name; the other one becomes truncated.)
Dog's name
Favourite food
Favourite thing
Cash on hand
ATM balance
Ness's name
Ness's level
Ness's EXP
Ness's current HP
Ness's rolling HP target
Ness's maximum HP
Ness's current PP
Ness's rolling PP target
Ness's maximum PP
Ness's current offence
Ness's current defence
Ness's current speed
Ness's current guts
Ness's current luck
Ness's current vitality
Ness's current IQ
Ness's base IQ
Ness's base offence
Ness's base defence
Ness's base speed
Ness's base guts
Ness's base luck
Paula's name
Paula's level
Paula's EXP
Paula's current HP
Paula's rolling HP target
Paula's maximum HP
Paula's current PP
Paula's rolling PP target
Paula's maximum PP
Paula's current offence
Paula's current defence
Paula's current speed
Paula's current guts
Paula's current luck
Paula's current vitality
Paula's current IQ
Paula's base IQ
Paula's base offence
Paula's base defence
Paula's base speed
Paula's base guts
Paula's base luck
Jeff's name
Jeff's level
Jeff's EXP
Jeff's current HP
Jeff's rolling HP target
Jeff's maximum HP
Jeff's current PP
Jeff's rolling PP target
Jeff's maximum PP
Jeff's current offence
Jeff's current defence
Jeff's current speed
Jeff's current guts
Jeff's current luck
Jeff's current vitality
Jeff's current IQ
Jeff's base IQ
Jeff's base offence
Jeff's base defence
Jeff's base speed
Jeff's base guts
Jeff's base luck
Poo's name
Poo's level
Poo's EXP
Poo's current HP
Poo's rolling HP target
Poo's maximum HP
Poo's current PP
Poo's rolling PP target
Poo's maximum PP
Poo's current offence
Poo's current defence
Poo's current speed
Poo's current guts
Poo's current luck
Poo's current vitality
Poo's current IQ
Poo's base IQ
Poo's base offence
Poo's base defence
Poo's base speed
Poo's base guts
Poo's base luck
get_stat_letter - Get one letter of text-based stat
For text-based stats like player names, get a singular letter based on the counter register. Stat IDs can be found at get_stat. Place it in a loop with the counter register to print the entire stat. For most non-text-based stats, the result will not be useful.
select_char_nocancel - Execute player character selection menu, not cancellable
CCS
MSG
Control code
select_char_nocancel(t1, t2, t3, t4, mode)
(Unknown)
1A 00 WW WW WW WW XX XX XX XX YY YY YY YY ZZ ZZ ZZ ZZ AA
Opens a player character selection menu with the current party members. Text callbacks can be assigned to execute when each player is highlighted. The selection cannot be cancelled with B.
mode controls if a menu with each character in the party's name should be provided (such as in a hospital). If mode is 1, then a window will be shown with the character names (the ID of this window changes depending on the party size to fit). If mode is any other value, then no window will be displayed, though if the HP/PP windows are open the hovered character's will be raised.
When writing a hover callback in mode 1, the callback must return focus to the window with the menu. The easiest way to do this is to use back_up_text_rendering_state at the beginning of the callback; the eob will handle returning the focus.
This is unused within the vanilla game, so the MSG equivalent is unknown.
select_char - Execute player character selection menu
CCS
MSG
Control code
select_char_nocancel(t1, t2, t3, t4, mode)
@SEL_PQ(t1, t2, t3, t4, mode)
1A 01 WW WW WW WW XX XX XX XX YY YY YY YY ZZ ZZ ZZ ZZ AA
Creates window of ID window and then displays the player character char's inventory in it. If the currently-focused window is window 1, it will first be closed. This is used in the vanilla game as a callback for menus to display player inventories while selecting a character.
Clears the current window, displays a shop menu, and allows the player to make a selection of an item to purchase. The shop ID is an entry in CoilSnake's store_table.yml. It returns the ID of the item chosen to purchase or 0 if the player pressed B.
show_storage_items - Open Escargo Express storage menu
Opens the Escargo Express storage inventory and allows the player to make a selection of an item to withdraw. It returns the slot of the item chosen to withdraw or 0 if the player pressed B. Acts strangely if there are no items in Escargo Express storage.
do_menu_nounload_nocancel - Execute selection menu without clearing loaded strings, not cancellable
CCS
MSG
Control code
do_menu_nounload_nocancel
(Unknown)
1A 08
Return location
Description
Result register
Menu item chosen
Similar to do_menu_nocancel, but it doesn't automatically clear the strings loaded with load_str and load_str_callonhover, so they can be reused in a later menu.
This goes unused in the vanilla game, so the MSG format equivalent is unknown.
do_menu_nounload - Execute selection menu without clearing loaded strings
ID of phone number that was called, or 0 if cancelled
Opens the phone menu and allows the player to make a phone call. If the player selects a number to call, its script (as defined in CoilSnake's telephone_contacts_table.yml) will be called. Additionally, the result register will be set to the ID (entry number in that table) of the number called, or 0 if the player pressed B to cancel.
Opens the PSI Teleport destination menu and allows the player to select a destination. The ID (in CoilSnake's psi_teleport_dest_table.yml) will be returned, or 0 if the player pressed B to cancel. This is unused in the vanilla game, so the MSG format equivalent is unknown.
store_registers - Back up registers locally
CCS
MSG
Control code
store_registers
@SAVE_REG()
1B 00
Return location
Description
Result register local backup
Value of the result register
Argument register local backup
Value of the argument register
Counter register local backup
Value of the counter register
The value of the result, argument, and counter registers are copied to the current window's local backup. They can be restored with load_registers.
load_registers - Restore registers from local backup
CCS
MSG
Control code
load_registers
@LOAD_REG()
1B 01
Return location
Description
Result register
Value of the result register local backup
Argument register
Value of the argument register local backup
Counter register
Value of the counter register local backup
The value of the result, argument, and counter registers are restored from the local backup created by store_registers.
Checks the value of the result register and moves text parsing to the location of target if it not zero.
swap - Swap values of result and argument registers
CCS
MSG
Control code
swap
@XCHG()
1B 04
Return location
Description
Result register
Value of the argument register
Argument register
Value of the result register
Transfers the values of the result and argument register between each other, such that no data is overwritten.
store_registers_global - Back up registers globally
CCS
MSG
Control code
store_registers_global
@SAVE_GLOABL_REG()
1B 05
Return location
Description
Result register global backup
Value of the result register
Argument register global backup
Value of the argument register
Counter register global backup
Value of the counter register
The value of the result, argument, and counter registers are copied to the global backup. They can be restored with load_registers_global. The global backup can be accessed by any window. Note that the counter register's global backup is only 8 bits wide.
load_registers_global - Restore registers from global backup
CCS
MSG
Control code
load_registers_global
@LOAD_GLOBAL_REG()
1B 06
Return location
Description
Result register
Value of the result register global backup
Argument register
Value of the argument register global backup
Counter register
Value of the counter register global backup
The value of the result, argument, and counter registers are restored from the global backup created by store_registers_global. The global backup can be accessed by any window.
text_color - Set text colour
CCS
MSG
Control code
text_color(col)
(Unknown)
1C 00 XX
Argument
Data length
Description
Behaviour if zero
col
byte
Text colour to set to
Changes the colour of text. More specifically, changes text to use a different palette from the window palettes. Note that due to hardware limitations, the changed colour will obey the 8x8 tile grid, not character spacing. The following colours are available:
Value
Description
Image (Peanut flavour)
0
Normal text
1
Appears normal (Used by misc UI elements like cursors)
2
Pink highlight (Some status effects?)
3
Appears normal (Used by special graphics like SMAAASH)
4
Flavour-based highlight (HP/PP window background)
5
Dark grey, flashes when HP/PP cards are open (Shop equip stuff)
6
Purple highlight (Selected menu options sometimes)
7
Interior border colour highlight (Window borders)
Using colours outside of this range causes graphical corruption of the printed text. This command goes unused in the vanilla game, so the MSG format equivalent is unknown.
stat - Print statistic
CCS
MSG
Control code
stat(stat)
@DSP_STS(stat)
1C 01 XX
Argument
Data length
Description
Behaviour if zero
stat
byte
Stat index to print
Argument register
Prints the statistic stat. Stat listings can be found under get_stat.
Prints a singular character. Not very useful with a static argument, but when setting character to 0, the argument register is read from instead, which is useful for commands such as get_name_letter.
open_hp - Display HP/PP cards
CCS
MSG
Control code
open_hp()
@DSP_PL()
1C 04
Displays the HP/PP cards of the current party. Unlike open_wallet, they update in real-time as the values are changed.
Prints strings loaded with load_str and load_str_callonhover horizontally in the current window, automatically spacing them out. count is the amount of strings to display. This usually precedes menu commands, but can also be used just to display text. count should match the amount of strings that were loaded, otherwise strange issues will occur.
gfx_text - Print special text graphics
CCS
MSG
Control code
gfx_text(num) smash youwon
@KMOJI(num)
1C 08 XX
Argument
Data length
Description
Behaviour if zero
num
byte
Graphic ID to print
Prints one of the special text graphics. Pass a value of 1 for "SMAAAASH!!" or pass a value of 2 for "YOU WON!" (or "YOU WIN!" in MOTHER 2).
CCScript also offers two self-explanatory aliases for this command: smash and youwon, both of which automatically add two spaces afterwards for some reason.
set_num_padding - Set number padding
CCS
MSG
Control code
set_num_padding(size)
(Unknown)
1C 09 XX
Argument
Data length
Description
Behaviour if zero
size
byte
Padding size
Configures number padding for the current window. If the most significant bit of size is set, then numbers printed via number will become right-aligned. The lower nybble dictates how many digits the printed numbers will be padded to (eg. if the intention is to print a right-aligned four-digit value, then set_num_padding(0x74) should be used to create the correct padding). If the most significant bit of size is not set, then numbers will be printed as usual.
This command goes unused in the vanilla game, so the MSG format equivalent is unknown.
number - Print number
CCS
MSG
Control code
number(n)
@DSP_NUM(n)
1C 0A XX XX XX XX
Argument
Data length
Description
Behaviour if zero
n
long
Number to print
Argument register
Prints the number n in decimal or the value in the argument register if n is zero.
money - Print number as money
CCS
MSG
Control code
money(n)
(Unknown)
1C 0B XX XX XX XX
Argument
Data length
Description
Behaviour if zero
n
long
Value to print
Argument register
Prints the number n in decimal or the value in the argument register if n is zero, but right-aligned and formatted with a dollar sign preceding and the "zero cents" symbol after.
This command is unused in the vanilla game, so the MSG format equivalent is unknown.
print_strings_vertical - Display loaded strings in columns
CCS
MSG
Control code
print_strings_vertical(columns)
@DSP_ITEML(columns)
1C 0C XX
Argument
Data length
Description
Behaviour if zero
columns
byte
Amount of columns
Argument register
Similar to print_strings_horizontal, but instead of printing strings in one row, allows them to be laid out across several rows. The amount of columns is specified by columns, and cells are populated left to right, top to bottom.
user - Print user of action
CCS
MSG
Control code
user
@DSP_ACTOR()
1C 0D
Prints the name of the last user of an item, attack, PSI ability, guard, etc. Commonly used in battle action and item usage text.
target - Print target of action
CCS
MSG
Control code
target
@DSP_OBJET()
1C 0E
Prints the name of the last target of an item, attack, PSI ability, etc. Commonly used in battle action and item usage text.
delta - Print delta of last change
CCS
MSG
Control code
delta
@DSP_CNUM()
1C 0F
Prints the delta of the last stat-changing effect. See get_delta for more information.
zwsp_before_letter - Insert new line if letter would cause overflow
This command only exists in EarthBound. The MOTHER 2 command that exists as the same control code is print_party_m2.
Checks the width of letter n, and if printing it would cause the text cursor to go beyond the right edge of the window, start a new line. This is used in the vanilla game to make sure that printing the player's name does not cause strange overflow, in much the same manner that ​ can be used in HTML.
While this command is used in the final game, it is not present in the localisation prototype, so the MSG format equivalent is unknown. In older versions of stdext, the command was zwsp and the argument was hardcoded to be 0.
print_party_m2 - Print short party description (MOTHER 2 only)
CCS
MSG
Control code
print_party_m2
@DSP_LCNAME()
1C 11
This command only exists in MOTHER 2. The EarthBound command that exists as the same control code is zwsp.
Prints a short description of the party. If the party only has one alive character, it will print their name. If it has more characters, it will print the leader's name + たち (tachi), which is something like "-'s group". In EarthBound, this functionality is achieved entirely through script.
psiname - Print PSI ability name
CCS
MSG
Control code
psiname(id)
@DSP_PSI(id)
1C 12 XX
Argument
Data length
Description
Behaviour if zero
id
byte
ID of PSI to print
Argument register
Prints the name of a PSI power. The ID of each PSI ability is from CoilSnake's psi_ability_table.yml.
battle_animation - Play battle animation
CCS
MSG
Control code
battle_animation(enemy, player)
@BTLFX(enemy, player)
1C 13 XX YY
Argument
Data length
Description
Behaviour if zero
enemy
byte
ID of animation to play (from an enemy's attack towards the party)
player
byte
ID of animation to play (from a player's attack towards an enemy)
Return location
Description
Result register
Direction of attack
Plays a battle animation, such as a PSI ability animation or from an item like the Shield Killer. The animation out of the two provided that is chosen is based on the current target during battle. The battle action will only play if the text prompt mode (see set_text_mode) is different from the normal mode (possibly an approximation of "is in battle"). The return value is the direction that ended up being chosen: 0 if the target is a party member, and 1 if the target is an enemy.
Gets info about the actor who did the last action and their group, such as attacking or using an item. If info is 1, then the gender of the user will be returned. If info is 2, then the amount of people remaining in the user's group will be returned, clamped at 3 for some reason (dead enemies/party members are excluded).
CCScript offers aliases for calling this command with the argument pre-filled, as get_user_gender and get_user_and_cohort_count for 1 and 2 respectively.
get_target_info - Get information about action target
CCS
MSG
Control code
get_target_info(info)
@GET_OBJECT(info)
1C 15 XX
Argument
Data length
Description
Behaviour if zero
info
byte
Type of information to get
Argument register
Return location
Description
Result register
Information about target
Similar to get_user_info, except the information is about the target of the action and their group instead of the user of the action and their group.
give - Add item to player inventory
CCS
MSG
Control code
give(char, item)
@GOODSIN(char, item)
1D 00 XX YY
Argument
Data length
Description
Behaviour if zero
char
byte
Party member to receive the item or -1 for the first free slot in the party
Adds an item to a player character's inventory and returns the ID of the character who received the item. By passing -1 for char, the item will be added to the first available inventory slot, working through the current party. In either case, if there is no available inventory space, nothing will happen and 0 will be returned.
take - Remove item from player inventory
CCS
MSG
Control code
take(char, item)
@GOODSOUT(char, item)
1D 01 XX YY
Argument
Data length
Description
Behaviour if zero
char
byte
Party member to take the item from or -1 for the first person in the party who has the item
Removes an item from a player character's inventory based on an item ID. By passing -1 for char, the first occurrence of the item will be found in all current party members' inventories. In either case, if the item is not found, nothing will happen.
arg_item_type_is_not - Compare type of item in argument register
Checks the player character char's inventory for any open slot. If -1 is passed for char, the inventories of all the current party members will be searched instead. In either case, the return value is the ID of the character if there is free space available, or 0 if there is no free space.
CCScript also offers notfull(char) as a functionally identical alias and full(char) which inverts the result using the not keyword.
Checks if the player character char has the item of ID item equipped in any of their four equipment slots. Returns 0 if the item is not equipped, 1 otherwise.
Checks if the player character char has the item of ID item in their inventory. If char is -1, then the inventories of all current party members will be searched. If the item is found, then the result register will be set to the ID of the character who has the item. If the item is not found, then the result register will be set to 0.
deposit - Add money to ATM balance
CCS
MSG
Control code
deposit(amt)
@DEPOSIT_MONEY_BANK(amt)
1D 06 XX XX XX XX
Argument
Data length
Description
Behaviour if zero
amt
long
Amount to deposit
Argument register
Adds $amt to the ATM balance. Please note that this does not remove the money from the wallet; takemoney must be used to accomplish that. Also, the ATM balance will silently cap at $9,999,999.
withdraw - Remove money from ATM balance
CCS
MSG
Control code
withdraw(amt)
@DRAW_MONEY_BANK(amt)
1D 07 XX XX XX XX
Argument
Data length
Description
Behaviour if zero
amt
long
Amount to withdraw
Argument register
Return location
Description
Result register
amt
Removes $amt from the ATM balance. Please note that this does not add the money to the wallet; givemoney must be used to accomplish that. If the amount of money to withdraw is greater than amt, no money will be subtracted. Sets the result register to the same as amt.
givemoney - Add money to wallet
CCS
MSG
Control code
givemoney(amt)
@MONEYIN(amt)
1D 08 XX XX
Argument
Data length
Description
Behaviour if zero
amt
short
Amount to add
Argument register
Return location
Description
Result register
Amount of money now in wallet
Adds $amt to the wallet. The amount of cash in the wallet will silently cap at $99,999.
takemoney - Remove money from wallet
CCS
MSG
Control code
takemoney(amt)
@MONEYOUT(amt)
1D 09 XX XX
Argument
Data length
Description
Behaviour if zero
amt
short
Amount to take
Argument register
Return location
Description
Result register
If the removal was successful
Attempts to remove $amt from the wallet. If the amount of money to take is more than is in the wallet, then the result register will be set to 0. If successful, it will be set to 1.
Gets the selling price of an item (ie. the money you receive when selling the item to a shop). This value is equal to half of the purchase price. Generally, items with a price of zero are treated as unsellable, and this is checked through text script.
check_impediment_for_storing - Check if item can currently be stored with Escargo Express
0 if item can be stored, various nonzero values otherwise
Checks if the item in slot of char's inventory can be put into Escargo Express storage. This checks both if the item is allowed to be stored and if there is space in storage. The following values are returned based on these checks:
Value
Item can be stored
Escargo has space
0
True
True
1
False
True
2
True
False
3
False
False
Therefore, the item should only be added to storage if the return value is zero.
Checks if a player character has a status effect. Status effects are sorted into groups, where only one status effect in that group may be active at once. Returns 1 if the character has that status, or 0 if they do not.
give_and_return_location - Add item, return information about receiver
CCS
MSG
Control code
give_and_return_location(char, item)
@GOODSIN_PLAYER(char, item)
1D 0E XX YY
Argument
Data length
Description
Behaviour if zero
char
byte
Party member to receive the item or -1 for the first free slot in the party
Similar to give, but the slot that the item was added to is additionally returned in the argument register. Since slots index from 1 in text script, this doubles as the amount of items present in their inventory.
Similar to take, but removes an item based on slot instead of item ID. Additionally, the character and the ID of the item that was removed are returned in the argument register.
item_at_location_is_equipped - Check if item in slot is equipped
Checks if the item at slot in char's inventory is able to be equipped by that character. This takes into account if that character specifically is able to equip the item - for instance, Ness cannot equip Jeff's blasters. Returns 1 if the item may be equipped, 0 otherwise.
take_from_location_and_store - Take item and store with Escargo Express
Removes the item at slot in Escargo Express storage and adds it to player character char's inventory. If there is no inventory space to receive the item, the item will simply vanish from Escargot, and the result register will be set to 0.
cannot_take_money - Check if value exceeds wallet balance
CCS
MSG
Control code
cannot_take_money(amt) hasmoney(amt)
@Q_MONEY(amt)
1D 14 XX XX XX XX
Argument
Data length
Description
Behaviour if zero
amt
long
Amount of money to query
Argument register
Return location
Description
Result register
If the value exceeds wallet balance
Checks if amt is greater than the amount of money currently in the wallet.
CCScript offers an alias for this command which inverts the result with the not keyword: hasmoney. The functionality then becomes "check if player has at least $amt".
get_party_size_times - Multiply value by party size
CCS
MSG
Control code
get_party_size_times(n)
@MUL_ACTIVE_PLAYER(n)
1D 15 XX XX
Argument
Data length
Description
Behaviour if zero
n
short
Amount to multiply
Argument register
Return location
Description
Result register
n × party size
Returns value n multiplied by the current size of the party. This is often used to calculate bus fares and hotel stay prices, as they depend on the amount of characters in the party.
cannot_withdraw - Check if value exceeds ATM balance
CCS
MSG
Control code
cannot_withdraw(amt)
@Q_BANK_MONEY(amt)
1D 17 XX XX XX XX
Argument
Data length
Description
Behaviour if zero
amt
long
Amount of money to query
Argument register
Return location
Description
Result register
If the value exceeds ATM balance
Checks if amt is greater than the amount of money currently in the ATM. CCScript does not offer an alias to invert this command, but the not keyword can be used.
Adds item of ID item to Escargo Express storage. This command does not remove the item from any player's inventory. For example, this is used if Buzz Buzz tries to give you the Sound Stone while your inventory is full: it is added to Escargo Express instead. If there is no space left in Escargo, the command does nothing.
party_size_smaller_than - Check if size of party is smaller than value
CCS
MSG
Control code
party_size_smaller_than(size)
@Q_MEMBER(size)
1D 19 XX
Argument
Data length
Description
Behaviour if zero
size
byte
Value to compare against
Argument register
Return location
Description
Result register
If party size is smaller than size
Checks if the current size of the party is smaller than size. If the size of the party is greater than or equal to size, then 0 is returned, otherwise 1.
user_and_target_names_identical - Check if action user and target are the same
CCS
MSG
Control code
user_and_target_names_identical
@Q_SELF()
1D 20
Return location
Description
Result register
If the user and target's names are the same
Returns true if the current action's user and target are the same. This is useful for things like item usage text: If the character eats a food item, then it would make the most sense to say "[character] ate the [item]", but if it is used on somebody else, then it would make the most sense to say "[character a] took the [item] and [character b] ate it." Specifically, the game compares the names of the user and target, so if two characters have the same name then this may return true even if they are different battlers.
random - Get random number between zero and value
CCS
MSG
Control code
random(max)
@RAND(max)
1D 21 XX
Argument
Data length
Description
Behaviour if zero
max
byte
Exclusive maximum
Argument register
Return location
Description
Result register
Random value
Returns a random value modulated by max. In other words, max is the exclusive maximum of the range.
can_use_exit_mouse - Check if the Exit Mouse can be used
CCS
MSG
Control code
can_use_exit_mouse
@Q_DUNGEON()
1D 22
Return location
Description
Result register
If Exit Mouse can be used
Checks if the Exit Mouse can be used in the sector the player is currently in. This can also be used to approximate if the player is in a dungeon, as the MSG format name implies.
get_equippable_item_type - Get type of equippable item
Checks if equippable item of ID item is offensive (weapon) or defensive (body, arms, other). The result may not be useful if the item is not equippable. Return values for valid items are:
Value
Definition
Description
0
(No definition)
Neither of the below
1
EQUIPPABLETYPE_OFFENSIVE
Things equipped in the Weapon slot
2
EQUIPPABLETYPE_DEFENSIVE
Things equipped in the other slots
get_dad_deposit_money_base - Get amount of money earned through battles
Returns the amount of money earned through battles. If reset2 is not 2, then the value will be returned and nothing else will happen. If reset2 is 2, then the value will be returned and the money-to-gain counter will be reset to zero. As the name implies, this is used when Dad tells you how much you have earned since the last time you called.
CCScript also offers two aliases for this command: get_dad_deposit_money and clear_dad_deposit_money. They function as passing 1 and 2 in reset respectively.
heal_percent - Increase HP by percentage of maximum HP
Heals a character for amount% of their maximum HP. It follows the normal rolling HP rules - if the HP/PP windows are open, the heal will occur gradually, otherwise it will occur instantly.
hurt_percent - Decrease HP by percentage of maximum HP
Changes a character's current level. Stats and known PSI abilities will be adjusted to match, but the after-battle level up script will not automatically occur. level can exceed 99, but graphical glitches may occur. Also, levels can be set to a lower value than they are currently, and stats will be changed accordingly.
boost_experience - Increase experience points of character
Increases the experience points of a character. If they are increased enough for a level up to occur, the level up script will occur. The character's total experience can not exceed 9,999,999 points.
Warning
The CCScript command boost_exp is deprecated and should not be used. It mistakenly takes three bytes for amount instead of four, which causes major issues. Use boost_experience instead.
Increases the Speed points of a character. If it is boosted beyond 255, it will be wrapped to 0. Therefore, adding signed (negative) numbers will work.
boost_vitality - Increase Vitality points of character
Increases the Vitality points of a character. If it is boosted beyond 255, it will be wrapped to 0. Therefore, adding signed (negative) numbers will work.
Increases the Luck points of a character. If it is boosted beyond 255, it will be wrapped to 0. Therefore, adding signed (negative) numbers will work.
music - Play music track
CCS
MSG
Control code
music(id)
@BGMSTART(id)
1F 00 00 XX
Argument
Data length
Description
Behaviour if zero
id
byte
Music track to play
Argument register
Plays a music track. IDs can be found using EBMusEd. If on the overworld, the music will return to normal when the player enters a new sector. The third byte is an unused argument that has no effect.
stop_music - Stop music track
CCS
MSG
Control code
stop_music music_stop
@BGMSTOP(0)
1F 01 XX
Argument
Data length
Description
Behaviour if zero
(Not in CCScript)
byte
(Unused)
Stops the current music track. If on the overworld, music will begin playing again when the player enters a new sector.
CCScript offers music_stop as an alias for this command. It was created earlier than stop_music. Both function identically, but music_stop sets the unused argument to 2 for an unknown reason. In the vanilla game, all instances of this command set the unused argument to 0.
sound - Play sound effect
CCS
MSG
Control code
sound(sfx)
@SE(sfx)
1F 02 XX
Argument
Data length
Description
Behaviour if zero
sfx
byte
Sound effect to play
Argument register
Plays the sound effect of ID sfx. Constants are provided, though many names are inaccurate:
Value
Definition
Description
1
SND_CURSORBLIP
Low "bip" cursor noise
2
SND_CURSORCONFIRM
High "bip" cursor noise
3
SND_CURSORBEEP
"Click" cursor noise
4
SND_CURSORNAME
Purpose unknown. Doesn't have to do with the naming screen despite definition
5
SND_ERRORBEEP
Unused "incorrect" sound
6
(No definition)
Silent. Contains muted data for a low door knock if the right instruments are loaded.
7
SND_TEXTBLIP
8
SND_DOOROPEN
Requires special instrument
9
SND_DOORCLOSE
Requires special instrument
10
SND_PHONERING
11
SND_PHONEPICKUP
Using or hanging up the phone
12
SND_KACHING
Cash register transaction. Requires special instrument
13
SND_FOOTSTEP
Camera shutter. Requires special instrument
14
SND_BEEOOP
Bubble Monkey floating
15
SND_BUZZ
Robotic footsteps in the Cave of the Past
16
SND_GIFTOPEN
Identical to 117
17
SND_LANDING
Falling down
18
SND_STAIRS
Requires special instrument
19
SND_HIGHBUZZ
Shallow water movement. Requires special instrument
20
SND_LOWBUZZ
Deep water movement. Requires special instrument
21
SND_SQUEAKYBUZZ
Magicant step. Requires special instrument
22
SND_TRUMPET
Onett's trumpet player
23
SND_MUFFLEDBUZZ
Bicycle bell. Requires special instrument
24
SND_HEROATTACK
25
SND_MONSTERATTACK
26
SND_BASH
27
SND_SHOOT
28
SND_PRAYING
29
SND_PSI1
30
SND_NORMALBASH
31
SND_SMASH
32
SND_HERODEATH
33
SND_ENEMYDEATH
34
SND_GIFTOPEN2
Attack misses
35
SND_DODGE
36
SND_RECOVER
HP recovery
37
SND_STATUSRECOVER
Status effect curing
38
SND_SHIELD1
Physical shield
39
SND_SHIELD2
Psychic shield
40
SND_STATSUP
41
SND_STATSDOWN
42
SND_HYPNOSIS
43
SND_MAGNET
44
SND_PARALYSIS
45
SND_BRAINSHOCK1
46
SND_THUMP
Party member damage
47
SND_CRITICAL
Party member mortal damage
48
SND_ROCKIN1
49
SND_ROCKIN2
50
SND_ROCKIN3
51
SND_FIRE1
52
SND_FIRE2
53
SND_FIRE3
54
SND_BRAINSHOCK2
55
SND_PSI2
56
SND_FREEZE1
57
SND_FREEZE2
58
SND_DEFENSEDOWN1
Actually the third sound for PSI Freeze
59
SND_DEFENSEDOWN2
Actually the HP Sucker
60
SND_THUNDERMISS
61
SND_THUNDERHIT1
62
SND_THUNDERHIT2
63
SND_THUNDERDAMAGE
64
SND_STARSTORM
65
SND_FLASH1
66
SND_FLASH2
67
SND_FLASH3
68
SND_EAT
69
SND_QUIETBEEP
70
SND_MISSILE
Throwing a bomb
71
SND_HISS
Spray cans
72
SND_STATUSCHANGE
Actually calling for help
73
SND_PING
74
SND_THUMP2
Lever sound
75
SND_MBR
Low rumble. Not the Multi Bottle Rocket as this apparently implies
76
SND_MAGNET2
77
SND_MAGNET3
Beam attacks
78
SND_WHIRR
Burp sound. Requires special instrument
79
SND_PARALYSIS2
80
SND_BRAINSHOCK3
81
SND_DRILL
Wave attacks
82
SND_SPORES
83
SND_AFFLICTED
84
SND_KERPOW
Shouting sound
85
SND_MYSTERIOUS
Zombies that do something mysterious
86
SND_WARBLING
A rumble with a warble behind it
87
(No definition)
Unused, silent sound effect
88
SND_SPROING
Not really a sproing. Rising high-ish noise
89
SND_REFUEL
90
SND_GIYGASWEAK
91
SND_FIRE4
92
SND_MUFFLEDBUZZ2
Little burp. Requires special instrument
93
SND_SHIELDREFLECT
94
SND_CHIRP
OKですか? Requires special instrument
95
SND_BUTTERFLY
96
SND_POSSESSED
97
SND_STAIRS2
Faster stairs. Requires special instrument
98
SND_DRUMS
Sound that was replaced with shouting in the localisation. This is the original sound
99
SND_STARMASTER
Also shield killer
100
SND_EDENWARP
101
SND_BIRDS
Requires special instrument
102
SND_SPECIALITEM
103
SND_LEARNPSI
104
SND_CHICKEN
105
SND_SPHINX1
106
SND_SPHINX2
107
SND_SPHINX3
108
SND_SPHINX4
109
SND_SPHINX5
110
SND_PYRAMIDOPEN
111
SND_RAPIDKNOCK
Requires special instrument
112
(No definition)
Very quiet drum noise. I believe it is attached to some doors?
113
SND_MANIMANI
114
SND_CREEPY
115
SND_BOXOPEN1
Equip item
116
SND_BOXTAKE
Get item
117
(No definition)
Present boxes opening. Identical to SND_GIFTOPEN (16)
118
SND_CHICKEN2
Giving item to NPC
119
SND_PSI3
Key used
120
SND_GUITAR
Secret transaction
121
SND_BEEP2
Pathway opened
122
SND_TRUMPETBLAST
Naming screen "pow". Requires special instrument
123
(No definition)
Naming screen "blip". Requires special instrument
124
SND_FUNKY
Naming screen "clonk". Requires special instrument
125
(No definition)
Naming screen "click". Requires special instrument
126
(No definition)
Naming screen "start". Requires special instrument
127
(No definition)
Unused "correct" sound
128
(No definition)
Very short "blip"
129
(No definition)
Like above but higher
music_resume - Play current sector's music
CCS
MSG
Control code
music_resume
@MUSISTART()
1F 03
Plays the music dictated by the sector the player is currently in. Useful if the music has stopped or changed during a cutscene or similar event. Note that it is not a genuine pause/resume function - the music will start from the beginning.
Changes when a "blip" sound effect should be played when text is printing. As well as raw values, definitions and alias commands are available:
Value
Definition
Description
Alias command
1
TEXTBLIPS_DEFAULT
Default behaviour. Plays sound on the overworld, but not in battle.
text_blips_default
2
TEXTBLIPS_ON
Always play sound, even in battle.
text_blips_on
3
TEXTBLIPS_OFF
Never play sound.
text_blips_off
music_switching_off - Prevent sectors changing music
CCS
MSG
Control code
music_switching_off
(Unknown)
1F 05
After using and finishing script execution, walking into a new sector will not cause the music to change to the track that the sector specifies. Going through a door or using another kind of warp will reset this.
This command is used in the final game, but cannot be found in the localisation script dump, so the MSG format equivalent is unknown.
music_switching_on - Allow sectors to change music
CCS
MSG
Control code
music_switching_on
(Unknown)
1F 06
If music_switching_off was previously used, sectors will once again be allowed to change music.
This command is unused in the final game, so the MSG format equivalent is unknown.
music_effect - Apply effect to music
CCS
MSG
Control code
music_effect(fx)
@BGM_EFFECT(fx)
1F 07 XX
Argument
Data length
Description
Behaviour if zero
fx
byte
Music effect
Argument register
Applies a special effect to the background music. Effects are as follows:
Value
Description
1
Normal playback
2
Fade out quickly
3
Fade out slowly
4
Do nothing
5
Increase playback speed for 1 second
6
Do nothing
7
Slide volume to 160 over 640ms
8
Slide volume to 240 over 1680ms
9
Set 0-4 channel volumes: {0, 0, 0, 0, 0}
10
Set 0-4 channel volumes: {0, 0, 0, 0, 0}
11
Set 0-4 channel volumes: {0, 0, 0, 0, 120}
12
Set 0-4 channel volumes: {100, 0, 0, 0, 120}
13
Set 0-4 channel volumes: {100, 100, 0, 0, 120}
14
Set 0-4 channel volumes: {100, 100, 0, 0, 120}
15
Set 0-4 channel volumes: {100, 100, 100, 0, 120}
16
Set 0-4 channel volumes: {100, 100, 100, 120, 120}
Creates an Actionscript object with a specific sprite and spawns it with an appearance animation. sprite is the sprite group ID for the object to use, script is the ID of the Actionscript that it should run, and style is the appearance style.
Makes the NPC of ID npc face in direction dir, from 0 to 7. Has no effect if the NPC is not present. CCScript offers a legacy alias for this command: sprite_direction.
npc_spawn - Generate Actionscript entity from NPC data
Creates an Actionscript object with NPC data from the NPC of ID npc. This includes setting their sprite and position, and the entity will be compatible with all NPC-reliant commands and other code. The NPC will not persist in this location permanently.
Generates a floating emote near an entity with NPC ID npc. Has no effect if the NPC is not present. The emote can be removed with hide_npc_float. CCScript offers a legacy alias for this command: show_sprite_float.
Deletes the emote near NPC of ID npc. Has no effect if the NPC is not present or the NPC does not currently have an attached emote. CCScript offers a legacy alias for this command: hide_sprite_float.
show_char_float - Generate floating emote near player character
Generates a floating emote near the player character entity of ID char. Has no effect if the character is not present. The emote can be removed with hide_char_float.
hide_char_float - Remove floating emotes by party member ID
Deletes all emotes associated with player character entity of ID char. Has no effect if the character is not present or they do not currently have an attached emote.
Deletes the entity with NPC ID npc. Has no effect if the NPC is not present. Does not permanently remove the NPC; if the player leaves and returns to the NPC's set location then it will reappear. CCScript offers a legacy alias for this command: hide_sprite.
Deletes the entity with sprite of ID sprite. Has no effect if no entity with that sprite is not present. If there are multiple entities with the sprite, only one will be deleted.
PSI Teleport α during the tutorial sequence. Handles the cutscene after the successful teleportation
warp - Move player to location with screen transition
CCS
MSG
Control code
warp(dest)
@WARP(dest)
1F 21 XX
Argument
Data length
Description
Behaviour if zero
dest
byte
Warp entry to use
Argument register
Performs a warp. The location and transition style is defined by the entry of ID warp in the warp destination table (teleport_destination_table.yml / Warp & TP mode in EBME).
start_battle - Begin scripted battle
CCS
MSG
Control code
start_battle(group)
@BATTLE(group)
1F 23 XX
Argument
Data length
Description
Behaviour if zero
group
byte
Enemy group to fight
Argument register
Return location
Description
Result register
Outcome of the battle (0 or 1)
Begins a battle against the enemy group group (an index in enemy_groups.yml). As a scripted battle, neither side will start with an advantage, and other enemies on the overworld cannot join in. The return value will be 1 for player victory, and 0 for all other cases (game over, or the unused Clumsy Robot death and Teleport Box item)
font_normal - Set the font to the regular font
CCS
MSG
Control code
font_normal
@FONTSTD()
1F 30
Changes the font to the normal font (ie. font 0)
font_saturn - Set the font to the Mr. Saturn font
CCS
MSG
Control code
font_saturn
@FONTBAKA()
1F 31
Changes the font to the Mr. Saturn font (ie. font 1)
event - Execute special event
CCS
MSG
Control code
event(id)
@FUNC(id)
1F 40 XX
Argument
Data length
Description
Behaviour if zero
id
byte
Special event to run
Return location
Description
Result register
Depends on event. 0 unless otherwise mentioned
Runs one of several special events. Events are:
Value
Definition
Description
1
EVENT_COFFEE
Coffee scene in Saturn Valley
2
EVENT_TEA
Tea scene in Tenda Village
3
EVENT_NAME1
Enter your name in Toto
4
EVENT_NAME2
Enter your name in Tenda Village
5
(No definition)
Enable OSS
6
(No definition)
Enable OSS if Giygas has been defeated, otherwise disable it
7
EVENT_TOWNMAP
Display the town map
8
(No definition)
Check if the current attacker's name is the same as the current target's name. Returns 1 if true, 0 if false
9
EVENT_SSTONE
Use the Sound Stone (can be skipped)
10
EVENT_TITLE
Show an image of the title screen
11
EVENT_CAST
Play the Cast scene
12
EVENT_CREDITS
Play the Staff scene
13
(No definition)
Make the HP/PP meters start going haywire, as when Ness clears Magicant
14
(No definition)
Stop the HP/PP meters going haywire from the above
15
(No definition)
Set all event flags to 0
16
(No definition)
Use the Sound Stone (cannot be skipped)
17
(No definition)
Attempt to inflict Homesickness. Returns 1 if successful, 0 if not
18
(No definition)
Attempt to get off the bicycle. If Ness was on the bike, returns 1, otherwise 0
disable_input - Disable player input for text prompts
CCS
MSG
Control code
disable_input
@DISKEY()
1F 50
Prevents the player from advancing through any text prompts that require input. Please note that this does not disable all input.
In normal play, hitting a text input prompt (promptw, prompt, and wait) will then cause the game to softlock. If debugging mode is enabled, it is possible to escape by pressing B and R at the same time. This is used in the vanilla game for Dad's phonecalls when you choose "End", though the ending of the game itself uses an infinite loop to achieve the same effect.
enable_input - Enable player input for text prompts
CCS
MSG
Control code
enable_input
(Unknown)
1F 51
Undoes the effect of disable_input, though the intended use of this is unknown as any effect that command has will cause a softlock in regular gameplay.
This command is unused in the final game, so the MSG format equivalent is unknown.
number_input - Get a number input from the player
CCS
MSG
Control code
number_input(digits)
@INPUT(digits)
1F 52 XX
Argument
Data length
Description
Behaviour if zero
digits
byte
Amount of digits for the input
Return location
Description
Result register
Value selected or 0 if cancelled
Argument register
0 if the player cancelled, unchanged otherwise
Creates a number selector with the specified amount of digits and waits until an input is confirmed. If the player cancels with B or Select, the amount returned will be zero and the argument register will also be set to 0. If the amount is confirmed with A or L (even if the value is zero), the argument register will not be changed.
wait_input_timeout - Wait for input with timeout
CCS
MSG
Control code
wait_input_timeout(duration)
@WKEY(duration)
1F 60 XX
Argument
Data length
Description
Behaviour if zero
duration
byte
Timeout duration in frames
Similar to wait, but will automatically advance if the user does not press the button within duration frames.
wait_movement - Wait for ActionScript to unlock text parsing
CCS
MSG
Control code
wait_movement
@WAITSYS()
1F 61
Halts parsing until any running ActionScript executes m_unlock_text. Used extensively for syncing text parsing with cutscenes.
set_text_mode - Set text behaviour
CCS
MSG
Control code
set_text_mode(mode)
@SET_BTL_MSG(mode)
1F 62 XX
Argument
Data length
Description
Behaviour if zero
mode
byte
Text prompt mode
Changes the behaviour of various things when printing text. Modes and their effects are as follows:
0
All prompts are enabled.
Text sound will be played unless explicitly disabled.
Queues a script to be ran on the next possible frame of normal overworld behaviour. Most importantly, this queued interaction will survive a door transition. In the vanilla game, this is used in scripts attached to doors to set up something to happen after the transition.
While the command is used in the vanilla game, the MSG dump seems to be missing the file containing door scripts, so the MSG format equivalent is unknown.
backup_party - Back up and clear money and temporary party members
CCS
MSG
Control code
backup_party
@SAVE_STORY()
1F 64
Saves a backup of both temporary party members and their HP, as well as the amount of money on hand, and then removes temporary party members and all money on hand. This is used for Jeff and Poo's solo sequences. This does not change the main characters in the party. The backup can later be restored with restore_party
restore_party - Restore temporary party members and money backup
CCS
MSG
Control code
restore_party
@LOAD_STORY()
1F 65
Restores the backup made by backup_party. Also does not change the main characters in the party.
Prepares a hotspot. The dimensions of the hotspot are given by the hotspot of ID hotspot, and can be edited in the map editor or map_hotspots.yml. There are two slots to load hotspots into, given in slot, and numbered 1 or 2. Therefore, only two hotspots can be active at a time.
Then, script will be executed at the next possible moment when the player moves within its boundaries. However, if the player is within the boundaries when this command is run, script will instead be executed when the player steps outside the boundaries.
Disables the hotspot slot given by slot. CCScript also provides 3 aliases for this command with arguments 1, 2, and 0 respectively: hotspot_slot1_off, hotspot_slot2_off, and hotspot_slot_arg_off.
anchor_set - Set the anchor position
CCS
MSG
Control code
anchor_set
(Unknown)
1F 68
Sets the anchor position, which can then be warped to with anchor_warp. In the vanilla game, this provides the functionality of the Exit Mouse by running this after entering dungeons.
While the command is used, the MSG dump seems to be missing the file containing door scripts, so the MSG format equivalent is unknown.
anchor_warp - Warp to anchor position
CCS
MSG
Control code
anchor_warp
@WARP_MOUSE_POS()
1F 69
Warps the player to the position saved with anchor_set. This also plays the "equipped item" sound effect. In the vanilla game, this provides the functionality of the Exit Mouse by running this when the item is used (provided some other conditions are met).
Learns one of the four scripted PSI. The char argument goes unused. psi is not a PSI ID but instead one of the following values, which constants and alias commands are provided for.
Value
Definition
Description
Alias command
1
LEARN_TELEPORT_ALPHA
Teleport α for Ness
learn_teleport_alpha
2
LEARN_STARSTORM_ALPHA
Starstorm α for Poo
learn_starstorm_alpha
3
LEARN_STARSTORM_OMEGA
Starstorm Ω for Poo
learn_starstorm_omega
4
LEARN_TELEPORT_BETA
Teleport β for Ness
learn_teleport_beta
Values outside of these four will have no effect. There is no mechanism in the vanilla game to learn any other PSI in this manner; only by level-up.
Checks if character char is able to use the item of ID item. This is the "x can use" flags set in item_configuration_table.yml. Please note that this does not check if an item is of a type that can be equipped; use can_equip_item_at_location for that purpose.
This command is unused in the vanilla game, so the MSG format equivalent is unknown.
Inventory slot of the item that was unequipped to make way, or 0 if none
Has character char equip the item at position slot in their inventory. The result register will be set to the slot of the item that was unequipped to make way for the new item, or 0 if no item was previously equipped.
The equipment slot (Weapons, Body, Arms, Other) is automatically determined by the item's properties. Note that this command does not check if the item is allowed to be equipped; use can_equip_item_at_location to determine that and act accordingly.
do_phone_menu - Open phone menu and select phone number
CCS
MSG
Control code
do_phone_menu
(Unknown)
1F 90
Return location
Description
Result register
ID of selected phone number
Opens the phone call menu and gets a selection from the player. The list is correctly populated based on who the player is allowed to call at the moment, depending on the configuration in telephone_contacts_table.yml, and the result register will be set to the index of the phone call that was selected.
This command is unused in the vanilla game, so the MSG format equivalent is unknown.
face_up_and_set_npc_flag - Make interacted NPC face upwards and set its flag (open present)
CCS
MSG
Control code
face_up_and_set_npc_flag open_present
@SETF_MSG()
1F A0
Makes the NPC that is currently being interacted with face upwards and sets its associated flag. This is used to make gift boxes open. Unpredictable results if there is no NPC currently being interacted with. CCScript offers an alias for this command: open_present.
face_down_and_clear_npc_flag - Make interacted NPC face downwards and unset its flag (close present)
CCS
MSG
Control code
face_down_and_clear_npc_flag close_present
@RESF_MSG()
1F A1
Makes the NPC that is currently being interacted with face downwards and unsets its associated flag. This is used to make gift boxes close. Unpredictable results if there is no NPC currently being interacted with. CCScript offers an alias for this command: close_present.
npc_flag_is_set - Check status of interact NPC's flag
CCS
MSG
Control code
npc_flag_is_set is_present_open
@CHKF_MSG()
1F A2
Return location
Description
Result register
Status of the flag (0 or 1)
Returns the status of the event flag associated with the NPC that is currently being interacted with. This is used to check if a gift box is open. Unpredictable results if there is no NPC currently being interacted with. CCScript offers an alias for this command: is_present_open.
save - Save the game
CCS
MSG
Control code
save
@SAVE_GAME()
1F B0
Saves the game. More specifically, copies the game state struct, party stats, and event flags to SRAM, then calculates and saves the checksums. If it is not successful (ie. the checksum or its compliment are not valid), then the process will repeat until it succeeds.
This does not set the location you respawn at. Use set_respawn_point for that.
switch_call - Call text subroutine based on result register
CCS
MSG
Control code
switch_call(num)
@ONGOSUB(...)
1F C0 XX
Argument
Data length
Description
Behaviour if zero
num
byte
Maximum expected value of result register
(Result register)
N/A
Switch statement jump index
Begin a switch statement. This should be followed by num instances of switch_entry. Based on the result register, one of the switch_entry locations will be called to in the same manner as call (ie. if the result register is 0, the first entry will be jumped to, if it is 1, the second entry will be jumped to, etc). This is often used in the vanilla game to provide similar functionality to goto_if_false / goto_if_true, but for subroutine behaviour instead.
try_fixing_an_item - Perform a random fix of one of Jeff's items
Attempts to fix the first applicable item in Jeff's inventory. The chance of the fix being successful is chance%. If the fix was successful, the result register will be set to the ID of the item after it is fixed, and the argument register will be set to the ID of the item when it was still broken. If the fix was unsuccessful, both are set to 0.
If Jeff is not in the party, no fix attempt is made, and both registers are set to 0.
find_direction_to_truffle - Find direction to nearby Magic Truffle
CCS
MSG
Control code
find_direction_to_truffle
@SEARCH_TRUFFLE()
1F D1
Return location
Description
Result register
Truffle search result
Attempts to find the direction to a nearby Magic Truffle, used by the Piggy Nose. Searches for any nearby entity with sprite ID 376. The search does not prioritise the closest truffle; instead the game only looks for the first one found within the internal loaded-entities array. The search works as follows:
If no truffles are loaded, return 0. Truffle NPCs (as with all NPCs) are loaded when the player comes near them in a rectangle somewhat larger than the screen.
If there is a truffle but the player is not within a 128x128 box around it, return 1
If the player is within the box but not within a 32x32 diamond around the truffle, return 10
If the player is within the diamond, return a value 2 through 9 for the clockwise direction to the truffle. That is, 2 is up, 3 is up-right, etc.
Here is a graphic picturing the above (excluding the first case). Where Ness is standing relative to the truffle in the center (his coordinates are horizontally centered and 8 pixels up from the bottom of the sprite), the corresponding value will be returned:
photo_time - Summon travelling photographer and take a picture
CCS
MSG
Control code
photo_time(id)
@TAKE_PHOTO(id)
1F D2 XX
Argument
Data length
Description
Behaviour if zero
id
byte
ID of photo event
Argument register
Summons the travelling photographer and asks the player to say "Fuzzy Pickles". id is the ID of the photo to be taken (see photgrapher_cfg_table.yml... whenever it's fixed). This handles the entire event except for setting/unsetting flags associated with the photograph - this must be done manually.
pathfinding_npc_time - Prepare delivery event
CCS
MSG
Control code
pathfinding_npc_time(id)
@DELIVERY(id)
1F D3 XX
Argument
Data length
Description
Behaviour if zero
id
byte
ID of delivery event
Prepares a delivery event. The delivery's configuration, including sprite to use, attempts, timer length, and success / failure scripts are in timed_delivery_table.yml, which id is an index into.
fade_map_palette - Fade map from one palette to another
CCS
MSG
Control code
fade_map_palette(pgroup, palette, duration)
@SET_PALLETSET(pgroup, palette, duration)
1F E1 XX YY ZZ
Argument
Data length
Description
Behaviour if zero
pgroup
byte
Palette group ID to fade to
palette
byte
Palette ID within the group to fade to
duration
byte
Length of the transition in frames
Transitions the map palette to another with a fading animation lasting duration frames. The destination palette has palette group pgroup and palette palette, which can be found in the map editor. This command allows any map to use any palette, even if it is not associated with the current tileset.
Disables tick and movement callbacks for the entity of party member char. If char is -1, all party members' entities are frozen. CCScript provides two aliases for this command: lock_movement(char), which still requires an argument, and party_freeze, which passes -1.
Enables tick and movement callbacks for the entity of party member char. If char is -1, all party members' entities are unfrozen. CCScript provides an alias for this command: party_unfreeze, which passes -1.
Disables sprite drawing for the entity of character ID char, or the entire party, with an appearance style. If char is -1, the entire party will be hidden. Unlike npc_delete and sprite2_delete, the entity is not destroyed, and can later be shown with show_char. If a given party member is not present, nothing will occur.
CCScript offers two aliases for this command: hide_char(char), and hide_party. hide_char(char) sets style to 6 for instant vanishing, and hide_party does the same but additionally sets char to -1 to instantly hide the entire party.
Enables sprite drawing for the entity of character ID char, or the entire party, with an appearance style. If char is -1, the entire party will be shown. If a given party member is not present, nothing will occur.
CCScript offers an alias for this command: show_party. This sets char to -1, but style must still be specified.
restore_camera - Reset camera focus to party
CCS
MSG
Control code
restore_camera
@SET_CAMERA_PARTY()
1F ED
Restores the camera to its default mode of following the party leader.
Sets the camera to follow-entity mode and has it focus on the entity with NPC ID npc. If there is no currently-loaded entity with that ID, undefined behaviour will occur.
The effect of this is to move the player position to the entity. The party must be unfrozen for this to take effect.
focus_camera_on_sprite2 - Set camera focus by sprite ID
Sets the camera to follow-entity mode and has it focus on the entity with sprite ID spr. If there is no currently-loaded entity with that ID, undefined behaviour will occur.
The effect of this is to move the player position to the entity. The party must be unfrozen for this to take effect.
bicycle - Attempt to get on bicycle
CCS
MSG
Control code
bicycle
@RIDE_CYCLE()
1F F0
Attempts to put Ness on the bicycle. If the party has more than one member, or the leader is not Ness, then nothing happens. Other checks, such as status effects and available space, happen in script and code around the vanilla use of this control code. Specifically, in order:
Attempting to use an item in an area where it's not allowed is controlled by sector properties and checked in code when trying to use any item of type 58.
Attempting to use the bicycle where there is not enough space is hardcoded and checked in code when trying to use specifically the bicycle item.
Using the bicycle when there is more than one party member is checked in script.
Using the bicycle when mushroomised is checked in script.
Using the bicycle when there is more than one party member is redundantly checked in the code for this command, and it exits silently.
Using the bicycle with a character other than Ness is checked in the code for this command, and it exits silently.
So, all checks besides the two associated with this command should be replicated where possible.
Deletes all emotes associated with an entity with NPC ID npc. Has no effect if the sprite is not present or does not have any emotes.
Command macro list
Macros that expand to several commands.
next - Prompt and linebreak
Usage
Expansion
next
promptw linebreak
Waits for user input while displaying a blinking triangle, followed by a linebreak. Very common across the entire game.
end - Wait and end
Usage
Expansion
end
wait eob
Waits for user input without displaying a blinking triangle, followed by ending the script. Very common at the end of basic scripts such as NPC dialogue.
toggle - Toggle flag state
Usage
Expansion
toggle(flag)
if isset(flag) unset(flag) else set(flag)
Toggles the state of a flag by branching based on if it is currently set or not. Will clobber the result register when used.
Pauses for five times the length of a single pause.
window_close - Switch to window and close it
Usage
Expansion
window_close(id)
window_switch(id) window_closetop
Switches to the specified window and then closes it. Focus is then returned to the window that was open previously.
input - Get number input and transfer to argument register
Usage
Expansion
input(digits)
number_input(digits) rtoarg
Gets a numerical input of up to digits digits from the player and then copies the inputted value to the argument register. The value will also remain in the result register.
arg - Set argument register
Usage
Expansion
arg(n)
counter(n) ctoarg
Initialises a constant value into the argument register. The counter register is also clobbered. Although the argument register is 32 bits wide, this is limited to 16-bit integers due to passing through the counter register. Attempting to set a value of 0 will simply cut off the top 16 bits of the argument register; use arg_zero to initialise that value.
arg_zero - Set argument register to zero
Usage
Expansion
arg_zero
hasmoney(0xFFFFFFFF) swap
Initialises a value of o into the argument register, which cannot be done through use of arg. This works by evaluating a condition that is guaranteed to be false (maximum money is far lower) and then moving the value to the argument register. As a side effect, the value of the argument register before using this command will end up in the result register.
counter_zero - Set counter register to zero
Usage
Expansion
counter_zero
arg_zero counter(0)
Like arg_zero, but then copies the value to the counter register too. Therefore, the argument and counter registers will be set to 0, and the result register will be set to the prior value of the argument register.
counter_is - Counter register equal to
Usage
Expansion
counter_is(n)
ctoarg swap result_is(n)
Compares the equality of the counter register to value n. The resulting value will be in the result register. The counter register will be unchanged, and the argument register will become the value of the result register before using this command.
healall - Restore HP and PP for the whole party
Usage
Expansion
healall
heal_percent(-1, 100) recoverpp_percent(-1, 100)
Recovers all HP and PP for the entire party. However, this does not recover status effects, and even dead characters will have their HP and PP restored, which does not allow them to battle but will show these values on the UI.
battle - Close windows and handle scripted battle
Usage
Expansion
battle(group)
window_closeall if start_battle(group) eob
Like start_battle, but includes safeguards for some common mistakes. In particular, all windows will be closed before the battle begins, and the script will be ended if the battle was not won. However, if this macro is used within a called script, then control will simply be returned to the caller.
ROM access macro list
Macros that use ROM[] and ROMTBL[] statements to modify mostly hardcoded game data. May or may not be safe to use with CoilSnake projects.
_asmptr - Repoint data
Usage
Expansion
_asmptr(loc, target)
ROMTBL[loc, 1, 1] = short [0] target ROMTBL[loc, 6, 1] = short [1] target
Replaces code for most pointer-loading done in the game. Anywhere code like
is found, _asmptr can be used with loc as the starting address of the snippet and target with the label or address to replace the pointer with. Largely unused these days due to ASMLoadAddress macros provided by asm65816.ccs.
sprite_link - Set an NPC's dialogue pointer
Caution
Not to be used with CoilSnake. It will either overwrite or be overwritten by CoilSnake's own NPC compilation, and can cause unpredictable damage if the NPC table is expanded by CoilSnake.
Usage
Expansion
sprite_link(id, target)
ROMTBL[0xCF898E, 0x11, id] = target
Sets an NPC's dialogue pointer to the label or address target. Used before CoilSnake was a thing.
newgame_location - Set starting coordinates
Usage
Expansion
newgame_location(x, y)
ROM[0xC1FE9E] = short x ROM[0xC1FE9B] = short y
Changes the location where a new game will begin. If the vanilla new-game script is kept, this actually only sets the starting location of the first flyover shot. To change where Ness wakes up, different modifications are needed.
newgame_startup - Set script to run on new game
Usage
Expansion
newgame_startup(target)
_asmptr(0xC1FEA4, target)
Changes the script that is ran at the beginning of a new game. The vanilla script handles the flyover cutscene and the meteor landing.
on_refresh - Set script to run on warp
Usage
Expansion
on_refresh(target)
_asmptr(0xC06B29, target)
Changes the script that is ran for every map warp, including doors and the like. The vanilla script spawns a sprite for Buzz Buzz when needed.
on_check - Mostly set the "No problem here" text
Usage
Expansion
on_check(target)
_asmptr(0xC13BE9, target)
Changes the script that is ran when the player selects "Check" from the command window and nothing to check is found. Does not change the script that is ran when pressing L on the overworld to quickly check something. The vanilla script is the famous "No problem here." text.
setup_music - Mostly set the file select music
Usage
Expansion
setup_music(music)
ROM[0xC1F04A] = byte music
Changes the music played when entering the file select screen. Does not change the music that is played when backing out to this screen after going to the naming screen.
setup_music2 - Set the rest of the file select music
Usage
Expansion
setup_music2(music)
ROM[0xC1F8FC] = byte music
Changes the music played when backing out to the file select screen after having advanced to the naming screen.
setup_background - Change file select and naming background
Usage
Expansion
setup_background(bg)
ROM[0xC0B5F1] = short bg
Changes the battle background displayed on the file select and naming screens. It is possible to change it to a background that's animated, though be aware that many operations on these screens cause heavy lag that will pause the animation.