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:

Group ID Group Description Statuses in the group Notes
1 Persistent (Easy to heal) 1. Unconscious
2. Diamondised
3. Paralysed
4. Nauseous
5. Poisoned
6. Sunstroke
7. Cold
Can be healed by different tiers of PSI healing
2 Persistent (Hard to heal) 1. Mushroomised
2. Possessed
Cannot be healed by PSI healing
3 Temporary 1. Asleep
2. Crying
3. Immobilised
4. Solidified
Cures automatically in some way. Goes away after battle
4 Strangeness 1. Feeling strange Goes away after battle
5 Concentration 1. Can't concentrate
2. Can't concentrate (for 4 turns)
Goes away after battle
6 Homesick 1. Homesick 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 appearstyle_1
2 APPEAR_BLINK Blink, starting fast, and then going slow appearstyle_2
3 APPEAR_HORZ Appear with interlaced horizontal lines appearstyle_3
4 APPEAR_VERT Appear with interlaced vertical lines appearstyle_4
5 APPEAR_SPRAY Appear with a spray effect appearstyle_5
6 (No definition) Instantly disappear appearstyle_6
7 APPEAR_FASTBLINK Blink, starting fast, and then going slow. Despite name, seems identical to APPEAR_BLINK appearstyle_7
8 VANISH_HORZ Disappear with interlaced horizontal lines appearstyle_8
9 VANISH_VERT Disappear with interlaced vertical lines appearstyle_9
10 VANISH_SPRAY Disappear with a spray effect appearstyle_10
-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:

Value Definition Description Image
1 FLOAT_SURPRISE Lines that indicate surprise emote_1
2 FLOAT_RADIO Captain Strong's radio emote_2
3 FLOAT_EXCLAIM Exclamation bubble emote_3
4 FLOAT_BULB Light bulb emote_4
5 FLOAT_ZAP Sky Runner's sparks emote_5
6 FLOAT_FLAG Unused flag emote_6
7 FLOAT_DRUMMER1 Runaway Five's drummer emote_7
8 FLOAT_DRUMMER2 Ditto, other direction emote_8
9 FLOAT_HEART Unused heart emote_9
10 FLOAT_BUSGUY1 Bus driver emote_10
11 FLOAT_BUSGUY2 Ditto, other direction emote_11

"To object" types

Special integers for identifying entity types for use with get_dir_from_char, get_dir_from_npc, and get_dir_from_sprite. Values are:

Value Definition Description
1 TO_CHAR Identify by party member ID
2 TO_NPC Identify by NPC ID
3 TO_SPRITE2 Identify by sprite ID

Other notes

  • 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.

Resources and external links


Command list

Commands that map to singular control codes.


linebreak - Line break

CCS MSG Control code
linebreak 00

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.


set - Set event flag

CCS MSG Control code
set(flag) @SETF(flag) 04 XX XX
Argument Data length Description Behaviour if zero
flag short Flag to set

Sets the event flag of ID flag.


unset - Clear event flag

CCS MSG Control code
unset(flag) @CLRF(flag) 05 XX XX
Argument Data length Description Behaviour if zero
flag short Flag to clear

Clears the event flag of ID flag.


goto_if_flag - Go to location if event flag set

CCS MSG Control code
goto_if_flag(flag, target) @CHKFGOTO(flag, target) 06 XX XX YY YY YY YY
Argument Data length Description Behaviour if zero
flag short Flag to check
target long Label or address to go to

Moves text parsing to the location of target if the event flag of ID flag is set.


isset - Check status of event flag

CCS MSG Control code
isset(flag) @CHKF(flag) 07 XX XX
Argument Data length Description Behaviour if zero
flag short Flag to check Argument register
Return location Description
Result register Status of the flag (0 or 1)

Returns the status of the event flag of ID flag.


call - Call text subroutine

CCS MSG Control code
call(target) @GOSUB(target) 08 XX XX XX XX
Argument Data length Description Behaviour if zero
target long Label or address to call

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.


switch_entry - Switch-statement case

CCS MSG Control code
switch_entry(target) N/A XX XX XX XX
Argument Data length Description Behaviour if zero
target long Label or address for this entry

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.


goto - Go to location

CCS MSG Control code
goto(target) @GOTO() 0A XX XX XX XX
Argument Data length Description Behaviour if zero
target long Label or address to go to

Moves text parsing to the location of target.


result_is - Result register equal to

CCS MSG Control code
result_is(num) @EQ(num) 0B 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 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.


window_open - Open text window

CCS MSG Control code
window_open(id) @OPEN(id) 18 01 XX
Argument Data length Description Behaviour if zero
id byte Window to open

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.


window_switch - Switch to open text window

CCS MSG Control code
window_switch(id) @SELECT_WIN(id) 18 03 XX
Argument Data length Description Behaviour if zero
id byte Window to switch to

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.


compare_register - Compare register to value

CCS MSG Control code
compare_register(num, register)
compare_result(num)
compare_argument(num)
compare_counter(num)
@CMP(num, register) 18 07 XX XX XX XX YY
Argument Data length Description Behaviour if zero
num long Value to compare
register byte ID of register to compare
Return location Description
Result register 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

CCS MSG Control code
do_menu_in_window_nocancel(id) Unknown 18 08 XX
Argument Data length Description Behaviour if zero
id byte Window to show menu in
Return location Description
Result register Menu item chosen

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

CCS MSG Control code
do_menu_in_window_nocancel(id) @WIN_SEL_ITEMQ(id) 18 09 XX
Argument Data length Description Behaviour if zero
id byte Window to show menu in
Return location Description
Result register Menu item chosen

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.


show_status - Show player character status

CCS MSG Control code
show_status(char) (Unknown) 18 0D XX 01
Argument Data length Description Behaviour if zero
char byte Party member to show stats of Result register

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

CCS MSG Control code
load_str_callonhover(str, callback) Unknown 19 02 ... 01 XX XX XX XX
Argument Data length Description Behaviour if zero
str Any String to load
callback long Label or address for 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.


unload_strings - Unload all menu strings

CCS MSG Control code
unload_strings @RESITEM() 19 04

Clears all loaded menu strings. This happens automatically upon executing a menu, except when using do_menu_nounload_nocancel and do_menu_nounload.


inflict_status - Inflict character with status effect

CCS MSG Control code
inflict_status(char, group, status)
inflict(char, groupandstatus)
@SET_SPECIAL(char, group, status) 19 05 XX YY ZZ
Argument Data length Description Behaviour if zero
char byte Party member to inflict Result register register
group byte Status group Argument register
status byte Status effect in the group

Inflicts a player character with a status effect. CCScript offers an alias for this command which combines the group and status into a single short.


get_char_at_pos - Get player character at party position

CCS MSG Control code
get_char_at_pos(position) @GET_ORDER_PLAYER(position) 19 10 XX
Argument Data length Description Behaviour if zero
position byte Position in the party, indexed from 1 Argument register
Return location Description
Result register Party member in that position

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

CCS MSG Control code
get_name_letter(char) @GET_PLAYER_NAME(char) 19 11 XX
Argument Data length Description Behaviour if zero
char byte Party member Argument register
(Counter register) N/A Index of letter
Return location Description
Result register Letter at the index

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

CCS MSG Control code
get_next_storage_item @GET_TRACY() 19 14
Argument Data length Description Behaviour if zero
(Counter register) N/A Index of item to get, starting from 1
Return location Description
Result register Item from carrier storage
Counter register Counter register + 1

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.


get_status - Get party member status in group

CCS MSG Control code
get_status(char, group) @GET_SPECIAL(char, group) 19 16 XX YY
Argument Data length Description Behaviour if zero
char byte Party member Result register
group byte Status group to check Argument register
Return location Description
Result register 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

CCS MSG Control code
get_levelup_exp(char) @GET_NEXTLEVEL(char) 19 18 XX
Argument Data length Description Behaviour if zero
char byte Party member to get exp. for Argument register
Return location Description
Result register Experience points to the next 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.


get_inventory_item - Get item from inventory slot

CCS MSG Control code
get_inventory_item(char, slot) @GET_PLAYER_GOODS(char, slot) 19 19 XX YY
Argument Data length Description Behaviour if zero
char byte Party member whose inventory to use Result register
slot byte Inventory slot Argument register
Return location Description
Result register Item in that slot

Gets the ID of an item in index slot of player character char's inventory. If there is no item in that slot, 0 will be returned.


get_storage_item - Get Escargo Express inventory item

CCS MSG Control code
get_storage_item(slot) @GET_TRACY_GOODS(slot) 19 1A XX
Argument Data length Description Behaviour if zero
slot byte Escargo Express inventory slot to check Argument register
Return location Description
Result register Item from Escargo inventory

Gets the item in Escargo Express inventory at index slot. If there is no item in that slot, it returns 0.


count_loaded_strings - Get amount of loaded strings in a window

CCS MSG Control code
count_loaded_strings(win) @WIN_CHK_ITEM(win) 19 1B XX
Argument Data length Description Behaviour if zero
win byte Window to check Focused window
Return location Description
Result register Number of loaded strings

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 Result register
slot byte Inventory slot of item to queue Argument register

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
Return location Description
Result register Original owner of the item
Argument register Inventory slot

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.


get_food_type - Get category of food item

CCS MSG Control code
get_food_type(item) @GET_GOODS_EAT(item) 19 21 XX
Argument Data length Description Behaviour if zero
item byte Item to check. Should only be a food-type item Argument register
Return location Description
Result register Category of food item

Gets the category of food-type item item. The result may not be useful if the item is not a food. The returned values are:

Value Definition Description
0 (No definition) Not food.
1 FOODTYPE_FOOD Items that are eaten. "Ness ate the..."
2 FOODTYPE_DRINK Items that are drank. "Ness drank the..."
3 FOODTYPE_CONDIMENT Items that can be sprinkled over others to enhance the flavour and effect.

get_dir_from_char - Get direction from character to object

CCS MSG Control code
get_dir_from_char(char, to_type, obj) @GET_PLAYER_DIR(char, to_type, obj) 19 22 XX YY ZZ
Argument Data length Description Behaviour if zero
char byte Party member to get direction from Result register
to_type byte "To object" type for target object
obj byte ID of object to find direction to Argument register
Return location Description
Result register Direction from the character to the object

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

CCS MSG Control code
get_dir_from_npc(npc, to_type, obj) @GET_CHAR_DIR(npc, to_type, obj) 19 23 XX YY ZZ
Argument Data length Description Behaviour if zero
npc byte NPC to get direction from Result register
to_type byte "To object" type for target object
obj byte ID of object to find direction to Argument register
Return location Description
Result register Direction from the NPC to the object

Similar to get_dir_from_char, but searches from an NPC of ID npc instead. Undefined behaviour if either the source or target cannot be found.


get_dir_from_sprite - Get direction from generated sprite to object

CCS MSG Control code
get_dir_from_sprite(sprite, to_type, obj) @GET_GOM_CHAR_DIR(sprite, to_type, obj) 19 24 XX YY ZZ
Argument Data length Description Behaviour if zero
sprite byte Sprite to get direction from Result register
to_type byte "To object" type for target object
obj byte ID of object to find direction to Argument register
Return location Description
Result register Direction from the sprite to the object

Similar to get_dir_from_char, but searches from a sprite of ID sprite instead. Undefined behaviour if either the source or target cannot be found.


find_condiment - Get first condiment, if applicable

CCS MSG Control code
find_condiment(item) @GET_SPICE(item) 19 25 XX
Argument Data length Description Behaviour if zero
item byte Item to get condiment for Argument register
Return location Description
Result register Item of the condiment or 0

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

CCS MSG Control code
set_respawn_point(teleport) @SET_COMEBACK_POS(teleport) 19 26 XX
Argument Data length Description Behaviour if zero
teleport byte PSI Teleport destination (unused) Argument register

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:

  1. Japanese player's name (MOTHER 2 remnant, Tony's question)
  2. 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.)
  3. Dog's name
  4. Favourite food
  5. Favourite thing
  6. Cash on hand
  7. ATM balance
  8. Ness's name
  9. Ness's level
  10. Ness's EXP
  11. Ness's current HP
  12. Ness's rolling HP target
  13. Ness's maximum HP
  14. Ness's current PP
  15. Ness's rolling PP target
  16. Ness's maximum PP
  17. Ness's current offence
  18. Ness's current defence
  19. Ness's current speed
  20. Ness's current guts
  21. Ness's current luck
  22. Ness's current vitality
  23. Ness's current IQ
  24. Ness's base IQ
  25. Ness's base offence
  26. Ness's base defence
  27. Ness's base speed
  28. Ness's base guts
  29. Ness's base luck
  30. Paula's name
  31. Paula's level
  32. Paula's EXP
  33. Paula's current HP
  34. Paula's rolling HP target
  35. Paula's maximum HP
  36. Paula's current PP
  37. Paula's rolling PP target
  38. Paula's maximum PP
  39. Paula's current offence
  40. Paula's current defence
  41. Paula's current speed
  42. Paula's current guts
  43. Paula's current luck
  44. Paula's current vitality
  45. Paula's current IQ
  46. Paula's base IQ
  47. Paula's base offence
  48. Paula's base defence
  49. Paula's base speed
  50. Paula's base guts
  51. Paula's base luck
  52. Jeff's name
  53. Jeff's level
  54. Jeff's EXP
  55. Jeff's current HP
  56. Jeff's rolling HP target
  57. Jeff's maximum HP
  58. Jeff's current PP
  59. Jeff's rolling PP target
  60. Jeff's maximum PP
  61. Jeff's current offence
  62. Jeff's current defence
  63. Jeff's current speed
  64. Jeff's current guts
  65. Jeff's current luck
  66. Jeff's current vitality
  67. Jeff's current IQ
  68. Jeff's base IQ
  69. Jeff's base offence
  70. Jeff's base defence
  71. Jeff's base speed
  72. Jeff's base guts
  73. Jeff's base luck
  74. Poo's name
  75. Poo's level
  76. Poo's EXP
  77. Poo's current HP
  78. Poo's rolling HP target
  79. Poo's maximum HP
  80. Poo's current PP
  81. Poo's rolling PP target
  82. Poo's maximum PP
  83. Poo's current offence
  84. Poo's current defence
  85. Poo's current speed
  86. Poo's current guts
  87. Poo's current luck
  88. Poo's current vitality
  89. Poo's current IQ
  90. Poo's base IQ
  91. Poo's base offence
  92. Poo's base defence
  93. Poo's base speed
  94. Poo's base guts
  95. Poo's base luck

get_stat_letter - Get one letter of text-based stat

CCS MSG Control code
get_stat_letter(stat) @GET_STS_CHAR(stat) 19 28 XX
Argument Data length Description Behaviour if zero
stat byte Stat ID to get letter from
(Counter register) N/A Index of letter to get
Return location Description
Result register Letter in 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
Argument Data length Description Behaviour if zero
t1 long Label or addressof callback when first character is hovered No callback
t2 long Label or address of callback when second character is hovered No callback
t3 long Label or address of callback when third character is hovered No callback
t4 long Label or address of callback when fourth character is hovered No callback
mode byte If a character menu should be provided
Return location Description
Result register Party member that was selected

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
Argument Data length Description Behaviour if zero
t1 long Label or address of callback when first character is hovered No callback
t2 long Label or address of callback when second character is hovered No callback
t3 long Label or address of callback when third character is hovered No callback
t4 long Label or address of callback when fourth character is hovered No callback
mode byte If a character menu should be provided
Return location Description
Result register Party member that was selected or 0 if cancelled

Similar to select_char_nocancel, but the menu can be cancelled with the B button, which will return 0.


do_menu_nocancel - Execute selection menu, not cancellable

CCS MSG Control code
do_menu_nocancel (Unknown) 1A 04
Return location Description
Result register Menu item chosen

Similar to do_menu, but the player cannot cancel by pressing the B button. This is unused in the vanilla game, so the MSG format equivalent is unknown


show_inventory - Show player character's inventory

CCS MSG Control code
show_inventory(window, char) @DSP_PLAYER_GOODS(window, char) 1A 05 XX YY
Argument Data length Description Behaviour if zero
window byte Window to display the inventory in
char byte Party member's inventory to display

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.


show_shop - Open shop menu and make selection

CCS MSG Control code
show_shop(id) @SEL_SHOP_TAKE(id) 1A 06 XX
Argument Data length Description Behaviour if zero
id byte Shop to display Argument register
Return location Description
Result register Item chosen to purchase or 0 if cancelled

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

CCS MSG Control code
show_storage_items @SEL_TRACY_OUT() 1A 07
Return location Description
Result register Inventory slot of the chosen item or 0 if cancelled

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

CCS MSG Control code
do_menu_nounload (Unknown) 1A 09
Return location Description
Result register Menu item chosen or 0 if cancelled

Similar to do_menu_nounload_nocancel, but the menu can be cancelled by pressing B.


phone_call - Make phone call

CCS MSG Control code
phone_call @SEL_TEL_GOSUB() 1A 0A
Return location Description
Result register 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.


do_teleport_locations_menu - Select PSI Teleport destination

CCS MSG Control code
do_teleport_locations_menu (Unknown) 1A 0B
Return location Description
Result register PSI Teleport destination selected, or 0 if cancelled

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.


goto_if_false - Go to if result register is 0

CCS MSG Control code
goto_if_false(target) @FALSE_GOTO(target) 1B 02 XX XX XX XX
Argument Data length Description Behaviour if zero
target long Label or address to go to
(Result register) N/A Only go to if zero

Checks the value of the result register and moves text parsing to the location of target if it is 0.


goto_if_true - Go to if result register is not 0

CCS MSG Control code
goto_if_true(target) @TRUE_GOTO(target) 1B 03 XX XX XX XX
Argument Data length Description Behaviour if zero
target long Label or address to go to
(Result register) N/A Only go to if nonzero

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 textcolour_0
1 Appears normal (Used by misc UI elements like cursors) textcolour_1
2 Pink highlight (Some status effects?) textcolour_2
3 Appears normal (Used by special graphics like SMAAASH) textcolour_3
4 Flavour-based highlight (HP/PP window background) textcolour_4
5 Dark grey, flashes when HP/PP cards are open (Shop equip stuff) textcolour_5
6 Purple highlight (Selected menu options sometimes) textcolour_6
7 Interior border colour highlight (Window borders) textcolour_7

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.


name - Print character name

CCS MSG Control code
name(char) @DSP_NAME(char) 1C 02 XX
Argument Data length Description Behaviour if zero
char byte Party member name to print Argument register

Prints the name of the party member char. Uniquely, setting char to -1 causes the value of the result register local backup to be used.


letter - Print single character

CCS MSG Control code
letter(character) @DSP_CHAR(character) 1C 03 XX
Argument Data length Description Behaviour if zero
character byte Letter to print Argument register

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.


itemname - Print item name

CCS MSG Control code
itemname(item) @DSP_GOODS(item) 1C 05 XX
Argument Data length Description Behaviour if zero
item byte Item to print name of Argument register

Prints the name of item of ID item.


teleportname - Print PSI Teleport destination name

CCS MSG Control code
teleportname(dest) (Unknown) 1C 06 XX
Argument Data length Description Behaviour if zero
dest byte PSI Teleport destination Argument register

Prints the name of PSI Teleport destination of ID dest. This is unused in the vanilla game, so the MSG format equivalent is unknown.


print_strings_horizontal - Display loaded strings horizontally

CCS MSG Control code
print_strings_horizontal(count) @DSP_ITEM(count) 1C 07 XX
Argument Data length Description Behaviour if zero
count byte Amount of strings to display Argument register

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

CCS MSG Control code
zwsp_before_letter(n) (Unknown) 1C 11 00
Argument Data length Description Behaviour if zero
n byte Letter to check Argument register

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 &ZeroWidthSpace; 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.

Animations are as follows:

  1. Counter-PSI Unit
  2. Brainshock α
  3. Brainshock β
  4. HP Sucker
  5. Defense Down α
  6. Defense Down Ω
  7. Fire α
  8. Fire β
  9. Fire γ
  10. Fire Ω
  11. Flash α
  12. Flash β
  13. Flash γ
  14. Flash Ω
  15. Freeze α
  16. Freeze β
  17. Freeze γ
  18. Freeze Ω
  19. Rockin α
  20. Rockin β
  21. Rockin γ
  22. Rockin Ω
  23. Paralysis α
  24. Paralysis Ω
  25. Magnet α
  26. Magnet Ω
  27. Shield Killer
  28. Hypnosis α
  29. Hypnosis Ω
  30. Hungry HP Sucker
  31. Starstorm α
  32. Starstorm Ω
  33. Thunder α/β
  34. Thunder γ/Ω
  35. Glitch Out?
  36. Enemy attack red - Fire
  37. Enemy attack orange - Unused
  38. Enemy attack brown - Unused
  39. Enemy attack blue - Defense Down
  40. Enemy attack white - Flash
  41. Enemy attack cyan - Freeze
  42. Enemy attack pink - Special
  43. Enemy attack green - Paralysis
  44. Enemy attack pale green - Magnet
  45. Enemy attack pale blue - Starstorm
  46. Enemy attack yellow - Thunder
  47. Slow screen-shake - Hypnosis, Brainshock, tornado attack
  48. Fast screen-shake (Teleport Box effect) - Unused
  49. Nothing
  50. White shield, enveloping party - Shield α/Σ
  51. Gold shield, enveloping party - Shield β/Ω
  52. Purple shield, enveloping party - PSI Shield α/Σ
  53. Blue shield, enveloping party - PSI Shield β/Ω
  54. Giygas's attack (expanding pink circle, directed at party)

get_user_info - Get information about action user

CCS MSG Control code
get_user_info(info)
get_user_gender
get_user_and_cohort_count
@GET_ACTOR(info) 1C 14 XX
Argument Data length Description Behaviour if zero
info byte Type of information to get
Return location Description
Result register Information about user

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 Result register
item byte Item to give Argument register
Return location Description
Result register Party member who received the item

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 Result register
item byte Item to take Argument register

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

CCS MSG Control code
arg_item_type_is_not(type)
arg_item_type_is(type)
@GOODS_TYPE_P(type) 1D 02 XX
Argument Data length Description Behaviour if zero
type byte Item type to compare to
(Argument register) N/A Item to check
Return location Description
Result register If the item types do not match

Compares the type of the item ID stored in the argument register. Values for type are:

  1. Special items (item type IDs 0, 4, 8)
  2. Equippable items (item type IDs 16, 17, 20, 24, 28)
  3. Food items (item type IDs 32, 36, 40, 44)
  4. Misc. items (item type IDs 48, 52, 53, 56, 58, 59)

CCScript offers arg_item_type_is(type) as an alias for this command which inverts the result using the not keyword.


get_item_receiver - Check for open inventory slot

CCS MSG Control code
get_item_receiver(char)
notfull(char)
full(char)
@Q_GOODSFULL(char) 1D 03 XX
Argument Data length Description Behaviour if zero
char byte Party member to check or -1 for the whole party Argument register
Return location Description
Result register Party member with free space or 0 if none

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.


hasequipped - Check if player has item equipped

CCS MSG Control code
hasequipped(char, item) @Q_EQUIP(char, item) 1D 04 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to check Result register
item byte Item to check for Argument register
Return location Description
Result register If the item is equipped

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.


hasitem - Check if item in inventory

CCS MSG Control code
hasitem(char, item) @Q_HAVE(char, item) 1D 05 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to check or -1 for the whole party Result register
item byte Item to check for Argument register
Return location Description
Result register Party member with the item or 0 if not found

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.


get_buying_price - Get purchase price of item

CCS MSG Control code
get_buying_price(item) @GOODS_TAKE_MONEY(item) 1D 0A XX
Argument Data length Description Behaviour if zero
item byte Item Argument register
Return location Description
Result register Price of item

Gets the purchase price of an item (ie. the price you need to pay to buy it from a shop).


get_selling_price - Get selling price of item

CCS MSG Control code
get_selling_price(item) @GOODS_SELL_MONEY(item) 1D 0B XX
Argument Data length Description Behaviour if zero
item byte Item Argument register
Return location Description
Result register Sell price of item

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

CCS MSG Control code
check_impediment_for_storing(char, slot) @Q_TRACY(char, slot) 1D 0C XX
Argument Data length Description Behaviour if zero
char byte Party member whose inventory is used Result register
slot byte Inventory slot for that character Argument register
Return location Description
Result register 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.


character_has_status - Check for status effect

CCS MSG Control code
character_has_status(char, group, status) @Q_SPECIAL(char, group, status) 1D 0D XX YY ZZ
Argument Data length Description Behaviour if zero
char byte Party member Result register
group byte Status group Argument register
status byte Status effect in the group
Return location Description
Result register If player has status

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 Result register
item byte Item to give Argument register
Return location Description
Result register Party member who received the item
Argument register Inventory slot the item was added to

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.


take_from_location - Remove item based on slot

CCS MSG Control code
take_from_location(char, slot) @GOODSOUT_PLAYER(char, slot) 1D 0F XX YY
Argument Data length Description Behaviour if zero
char byte Party member Result register
slot byte Inventory slot of that character's inventory Argument register
Return location Description
Result register Party member that the item was taken from
Argument register Item that was taken

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

CCS MSG Control code
item_at_location_is_equipped(char, slot) Unknown 1D 10 XX YY
Argument Data length Description Behaviour if zero
char byte Party member Result register
slot byte Inventory slot in that character's inventory Argument register
Return location Description
Result register If item is equipped

Checks if the item at slot in char's inventory is equipped. Returns 1 if it is equipped, 0 otherwise.

This command is unused in the vanilla game, so the MSG format equivalent is unknown.


can_equip_item_at_location - Check if item in slot is able to be equipped

CCS MSG Control code
can_equip_item_at_location(char, slot) @Q_EQUIP_PLAYER_GOODS(char, slot) 1D 11 XX YY
Argument Data length Description Behaviour if zero
char byte Party member Result register
slot byte Inventory slot in that player's inventory Argument register
Return location Description
Result register If item is able to be 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

CCS MSG Control code
take_from_location_and_store(char, slot) @TRACY_IN_GOODS(char, slot) 1D 12 XX YY
Argument Data length Description Behaviour if zero
char byte Party member Result register
slot byte Inventory slot in that player's inventory Argument register

Removes the item at slot in char's inventory and adds it to Escargo Express storage.


give_and_unstore_item - Give item and remove from Escargo Express

CCS MSG Control code
give_and_unstore_item(char, slot) @TRACY_OUT_GOODS(char, slot) 1D 13 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to receive item Result register
slot byte Inventory slot in Escargo Express storage Argument register
Return location Description
Result register Party member that received the item or 0
Argument register Last filled inventory slot of that character

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.


store_item - Add item to Escargo Express storage

CCS MSG Control code
store_item(item) @TRACY_IN(item) 1D 18 XX
Argument Data length Description Behaviour if zero
item byte Item to add Argument register

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

CCS MSG Control code
get_equippable_item_type(item) @Q_EQUIP_ATTR(item) 1D 23 XX
Argument Data length Description Behaviour if zero
item byte Item to check Argument register
Return location Description
Result register Equipment type

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

CCS MSG Control code
get_dad_deposit_money_base(reset2)
get_dad_deposit_money
clear_dad_deposit_money
@Q_FIGHT_MONEY(reset2) 1D 24 XX
Argument Data length Description Behaviour if zero
byte reset2 If 2, the value will be reset
Return location Description
Result register Amount of money earned

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

CCS MSG Control code
heal_percent(char, amount) @HP_UP(char, amount) 1E 00 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to heal Argument register
amount byte Percentage to heal for

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

CCS MSG Control code
hurt_percent(char, amount) @HP_DOWN(char, amount) 1E 01 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to damage Argument register
amount byte Percentage to damage for

Damages a character for amount% of their maximum HP. It follows the normal rolling HP rules (see heal_percent).


heal - Increase HP by value

CCS MSG Control code
heal(char, amount) (Unknown) 1E 02 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to heal Argument register
amount byte Value to heal for

Heals a character for amount HP. It follows the normal rolling HP rules (see heal_percent).

This command is unused in the final game, so the MSG format equivalent is unknown.


hurt - Decrease HP by value

CCS MSG Control code
hurt(char, amount) (Unknown) 1E 03 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to damage Argument register
amount byte Value to damage for

Damages a character for amount HP. It follows the normal rolling HP rules (see heal_percent).

This command is unused in the final game, so the MSG format equivalent is unknown.


recoverpp_percent - Increase PP by percentage of maximum PP

CCS MSG Control code
recoverpp_percent(char, amount) @PP_UP(char, amount) 1E 04 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to recover PP Argument register
amount byte Percentage to recover for

Recovers the PP of a character by amount% of their maximum PP.


consumepp_percent - Decrease PP by percentage of maximum PP

CCS MSG Control code
consumepp_percent(char, amount) @PP_DOWN(char, amount) 1E 05 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to reduce PP Argument register
amount byte Percentage to reduce for

Reduces the PP of a character by amount% of their maximum PP.


recoverpp - Increase PP by value

CCS MSG Control code
recoverpp(char, amount) (Unknown) 1E 06 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to recover PP Argument register
amount byte Value to recover for

Increases a character's PP by amount points.

This command is unused in the final game, so the MSG format equivalent is unknown.


consumepp - Decrease PP by value

CCS MSG Control code
consumepp(char, amount) (Unknown) 1E 07 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to reduce PP Argument register
amount byte Value to reduce for

Reduces a character's PP by amount points.

This command is unused in the final game, so the MSG format equivalent is unknown.


change_level - Set level of character

CCS MSG Control code
change_level(char, level) @SET_LEVEL(char, level) 1E 08 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to change level Result register
level byte Level to set to Argument register

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

CCS MSG Control code
boost_experience(char, amount)
boost_exp(char, amount)
@EXP_UP_POINT(char, amount) 1E 09 XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost exp. of
amount long Amount to increase by

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.


boost_iq - Increase IQ points of character

CCS MSG Control code
boost_iq(char, amount)
@IQ_UP_POINT(char, amount) 1E 0A XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost IQ Argument register
amount long Amount to increase by

Increases the IQ points of a character. If it is boosted beyond 255, it will be wrapped to 0. Therefore, adding signed (negative) numbers will work.


boost_guts - Increase Guts points of character

CCS MSG Control code
boost_guts(char, amount)
@GUTS_UP_POINT(char, amount) 1E 0B XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost Guts Argument register
amount long Amount to increase by

Increases the Guts points of a character. If it is boosted beyond 255, it will be wrapped to 0. Therefore, adding signed (negative) numbers will work.


boost_speed - Increase Speed points of character

CCS MSG Control code
boost_speed(char, amount)
@SPEED_UP_POINT(char, amount) 1E 0C XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost Speed Argument register
amount long Amount to increase by

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

CCS MSG Control code
boost_vitality(char, amount)
@VITAL_UP_POINT(char, amount) 1E 0D XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost Vitality Argument register
amount long Amount to increase by

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.


boost_luck - Increase Luck points of character

CCS MSG Control code
boost_luck(char, amount)
@LUCK_UP_POINT(char, amount) 1E 0E XX YY YY YY YY
Argument Data length Description Behaviour if zero
char byte Party member to boost Luck Argument register
amount long Amount to increase by

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.


text_blips - Change text-printing sound behaviour

CCS MSG Control code
text_blips(type)
text_blips_default
text_blips_on
text_blips_off
@MESSAGE_SOUND(type) 1F 04 XX
Argument Data length Description Behaviour if zero
type byte Text-printing sound behaviour Argument register

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}
17 Do nothing
18 Do nothing
19 Do nothing
20 Do nothing
21 Transpose to 16 semitones
22 Transpose to 0 semitones
23 Set volume to 100
24 Set volume to 240
25 Set channel 7 volume to 250
26 Set channel 7 volume to 0
27 Set channel 7 volume to 90
28 Set channel 7 volume to 40

party_add - Add character to party

CCS MSG Control code
party_add(char) @ADD_PARTY(char) 1F 11 XX
Argument Data length Description Behaviour if zero
char byte Party member to add Argument register

Adds a character to the party. If the character is already present, nothing will happen. This doesn't automatically handle the fanfare and text.


party_remove - Remove character from party

CCS MSG Control code
party_remove(char) @DEL_PARTY(char) 1F 12 XX
Argument Data length Description Behaviour if zero
char byte Party member to remove Argument register

Removes a character from the party. If the character is not present, nothing will happen. Take care never to remove all characters from the party.


char_direction - Make party member face direction

CCS MSG Control code
char_direction(char, dir) @SET_PLAYER_DIR(char, dir) 1F 13 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to change direction Result register
dir byte Direction for character to face Argument register

Makes the sprite of a party member face in a certain direction.


party_direction - Make party face direction

CCS MSG Control code
party_direction(dir) @SET_PARTY_DIR(dir) 1F 14 XX
Argument Data length Description Behaviour if zero
dir byte Direction for party to face Argument register

Makes the whole party face in a certain direction


sprite2_spawn - Generate Actionscript entity

CCS MSG Control code
sprite2_spawn(sprite, script, style) @MOVE_GOM_CHAR(sprite, script, style) 1F 15 XX XX YY YY ZZ
Argument Data length Description Behaviour if zero
sprite short Sprite of generated entity
script short Actionscript of generated entity
style byte Appearance style

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.


npc_direction - Make NPC face in a direction

CCS MSG Control code
npc_direction(npc, dir)
sprite_direction(npc, dir)
@SET_CHAR_DIR(npc, dir) 1F 16 XX XX YY
Argument Data length Description Behaviour if zero
npc short NPC to adjust direction Result register
dir byte Direction to face Argument register

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

CCS MSG Control code
npc_spawn(npc, script, style) @MOVE_CHAR(npc, script, style) 1F 17 XX XX YY YY ZZ
Argument Data length Description Behaviour if zero
npc short NPC to use data of
script short Actionscript of generated entity
style byte Appearance style

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.


show_npc_float - Generate floating emote near NPC

CCS MSG Control code
show_npc_float(npc, emote) @SHOW_MANPU_CHAR(npc, emote) 1F 1A XX XX YY
Argument Data length Description Behaviour if zero
npc short NPC to spawn near
emote byte Floating emote

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.


hide_npc_float - Remove floating emotes by NPC ID

CCS MSG Control code
hide_npc_float(npc)
hide_sprite_float(npc)
@HIDE_MANPU_CHAR(npc) 1F 1B XX XX
Argument Data length Description Behaviour if zero
npc short NPC to remove emotes from

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

CCS MSG Control code
show_char_float(char, emote) @SHOW_MANPU_PLAYER(char, emote) 1F 1C XX YY
Argument Data length Description Behaviour if zero
char byte Party member to spawn near Result register
emote byte Floating emote Argument register

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

CCS MSG Control code
hide_char_float(char) @HIDE_MANPU_PLAYER(npc) 1F 1D XX
Argument Data length Description Behaviour if zero
char byte Party member to remove emotes from Result register

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.


npc_delete - Delete entity by NPC ID

CCS MSG Control code
npc_delete(npc, style)
hide_sprite(npc, style)
@HIDE_CHAR(npc, style) 1F 1E XX XX YY
Argument Data length Description Behaviour if zero
npc short NPC to delete
style byte Appearance style

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.


sprite2_delete - Delete entity by sprite ID

CCS MSG Control code
sprite2_delete(sprite, style) @HIDE_GOM_CHAR(flag, target) 1F 1F XX XX YY
Argument Data length Description Behaviour if zero
sprite short Sprite to delete Argument register
style byte Appearance style

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.


teleport - Begin PSI Teleport to location

CCS MSG Control code
teleport(dest, style) @TELEPORT(dest, style) 1F 20 XX YY
Argument Data length Description Behaviour if zero
dest byte PSI Teleport destination to go to Result register
style byte PSI Teleport style Argument register

Starts PSI Teleport to a given destination. style can be:

Value Definition Description
1 TELEPORT_ALPHA PSI Teleport α
2 TELEPORT_BETA PSI Teleport β
3 (No definition) Instantly move to destination
4 TELEPORT_OMEGA Scripted, uncontrollable, no-collision PSI Teleport β
5 (No definition) 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.
  • 1
    • Ignore all prompts except for prompt.
    • Text sound will not be played unless explicitly enabled.
    • Skips drawing start-of-line characters (not exactly sure what this implies).
  • 2
    • Ignore all prompts except for prompt.
    • Text sound will not be played unless explicitly enabled.

When in battle, the text mode is set to 2 any time battle text is printed. Level-up text will set the text mode to 1.


queue_text - Queue text to run at next possible moment

CCS MSG Control code
queue_text(script) (Unknown) 1F 63 XX XX XX XX
Argument Data length Description Behaviour if zero
script long Label or address of script to run

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.


hotspot_on - Set up a hotspot slot

CCS MSG Control code
enable_hotspot(slot, hotspot, script) @SET_HIT_RECT(slot, hotspot, script) 1F 66 XX YY ZZ ZZ ZZ ZZ
Argument Data length Description Behaviour if zero
slot byte Slot to use Argument register
hotspot byte Hotspot ID to use dimensions of Result register
script long Label or address of script on touch

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.


hotspot_off - Disable a hotspot slot

CCS MSG Control code
disable_hotspot(slot)
hotspot_slot1_off
hotspot_slot2_off
hotspot_slot_arg_off
@RES_HIT_RECT(slot) 1F 67
Argument Data length Description Behaviour if zero
slot byte Slot to disable Argument register

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).


learnpsi - Learn scripted PSI

CCS MSG Control code
learnpsi(char, psi)
learn_teleport_alpha
learn_starstorm_alpha
learn_starstorm_omega
learn_teleport_beta
@ADD_PSI(char, psi) 1F 71 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to learn PSI
psi byte ID of scripted PSI to learn

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.


usable - Check if item can be used by a character

CCS MSG Control code
usable(char, item) (Unknown) 1F 81 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to check Result register
item byte Item Argument register
Return location Description
Result register If the character may use the item

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.


equip - Equip the item in inventory slot

CCS MSG Control code
equip(char, slot) @EQUIP+PLAYER_GOODS(char, slot) 1F 83 XX YY
Argument Data length Description Behaviour if zero
char byte Party member to equip the item Result register
slot byte Inventory slot of item to equip Argument register
Return location Description
Result register 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

CCS MSG Control code
try_fixing_an_item(chance) @REPAIR(chance) 1F D0 XX
Argument Data length Description Behaviour if zero
chance byte Chance of success in % Argument register
Return location Description
Result register Newly-fixed item or 0
Argument register Previously-broken item or 0

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:

truffledir

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.


sprite2_direction - Change direction of sprite

CCS MSG Control code
sprite2_direction(spr, dir) @SET_GOM_CHAR_DIR(spr, dir) 1F E4 XX XX YY
Argument Data length Description Behaviour if zero
spr short Sprite to change direction Result register
dir byte Direction to set to Argument register

Changes the direction of an entity with sprite ID spr to dir.

If no entity with the specified sprite ID is found, nothing happens.


char_freeze - Freeze entity by party member ID

CCS MSG Control code
char_freeze(char)
lock_movement(char)
party_freeze
@COLD_PLAYER(char) 1F E5 XX
Argument Data length Description Behaviour if zero
char byte Party member to freeze or -1 for everyone

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.


npc_freeze - Freeze entity by NPC ID

CCS MSG Control code
npc_freeze(npc) @COLD_CHAR(npc) 1F E6 XX XX
Argument Data length Description Behaviour if zero
npc short NPC to freeze

Disables tick and movement callbacks for the entity with NPC ID npc. If no matching entites are found, nothing will happen.


sprite2_freeze - Freeze entity by sprite ID

CCS MSG Control code
sprite2_freeze(spr) @COLD_GOM_CHAR(spr) 1F E7 XX XX
Argument Data length Description Behaviour if zero
spr short Sprite to freeze

Disables the tick and movement callbacks for the entity with sprite ID spr. If no matching entities are found, nothing will happen.


char_unfreeze - Unfreeze entity by party member ID

CCS MSG Control code
char_unfreeze(char)
party_unfreeze
@FRESH_PLAYER(char) 1F E8 XX
Argument Data length Description Behaviour if zero
char byte Party member to unfreeze or -1 for everyone

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.


npc_unfreeze - Unfreeze entity by NPC ID

CCS MSG Control code
npc_unfreeze(npc) @FRESH_CHAR(npc) 1F E9 XX XX
Argument Data length Description Behaviour if zero
npc short NPC to freeze

Enables tick and movement callbacks for the entity with NPC ID npc. If no matching entities are found, nothing will happen.


sprite2_unfreeze - Unfreeze entity by sprite ID

CCS MSG Control code
sprite2_unfreeze(spr) @FRESH_GOM_CHAR(spr) 1F EA XX XX
Argument Data length Description Behaviour if zero
spr short Sprite to freeze

Enables tick and movement callbacks for the entity with sprite ID spr. If no matching entities are found, nothing will happen.


hide_char_with_style - Hide entity by party member ID

CCS MSG Control code
hide_char_with_style(char, style)
hide_char(char)
hide_party
@HIDE_PLAYER(char, style) 1F EB XX XX
Argument Data length Description Behaviour if zero
char byte Party member to hide or -1 for everyone
style byte Appearance style

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.


show_char - Show entity by party member ID

CCS MSG Control code
show_char(char, style)
show_party(style)
@SHOW_PLAYER(char, style) 1F EC XX XX
Argument Data length Description Behaviour if zero
char byte Party member to show or -1 for everyone
style byte Appearance style

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.


focus_camera_on_npc - Set camera focus by NPC ID

CCS MSG Control code
focus_camera_on_npc(npc) @SET_CAMERA_CHAR(npc) 1F EE XX XX
Argument Data length Description Behaviour if zero
npc short NPC to focus on

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

CCS MSG Control code
focus_camera_on_sprite2(spr) @SET_CAMERA_GOM_CHAR(spr) 1F EF XX XX
Argument Data length Description Behaviour if zero
spr short Sprite to focus on

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.


npc_do_mc - Change entity Actionscript by NPC ID

CCS MSG Control code
npc_do_mc(npc, script) @REMOVE_CHAR(npc, script) 1F F1 XX XX YY YY
Argument Data length Description Behaviour if zero
npc short NPC to change script
script short Actionscript to assign to it

Changes the Actionscript of an entity with NPC ID npc to script. If no matching entities are found, nothing will happen.


sprite2_do_mc - Change entity Actionscript by sprite ID

CCS MSG Control code
sprite2_do_mc(spr, script) @REMOVE_GOM_CHAR(spr, script) 1F F2 XX XX YY YY
Argument Data length Description Behaviour if zero
spr short Sprite to change script
script short Actionscript to assign to it

Changes the Actionscript of an entity with sprite ID spr to script. If no matching entities are found, nothing will happen.


show_sprite2_float - Generate floating emote near sprite

CCS MSG Control code
show_sprite2_float(sprite, emote) @SHOW_MANPU_GOM_CHAR(sprite, emote) 1F F3 XX XX YY
Argument Data length Description Behaviour if zero
sprite short Sprite to spawn near
emote byte Floating emote

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_sprite2_float.


hide_sprite2_float - Remove floating emotes by sprite ID

CCS MSG Control code
hide_sprite2_float(sprite) @HIDE_MANPU_GOM_CHAR(sprite) 1F F4 XX XX
Argument Data length Description Behaviour if zero
sprite short Sprite to remove emotes from

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.


longpause - Pause five times the length

Usage Expansion
longpause(len) pause(len) pause(len) pause(len) pause(len) pause(len)

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

LDA .loword(table)
STA $dp
LDA .hiword(table)
STA $dp+2

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.


Table of Contents

⚠️ **GitHub.com Fallback** ⚠️