List of text control codes

From Glitch City Wiki
(Redirected from Control character)
Jump to navigation Jump to search
This article is incomplete. Please feel free to add any missing information about the subject. It is missing: Cleanup, add more text commands used at the beginning of text, add commands that play Pokémon cries, mention invalid control codes in the Japanese versions, such as text command 0x7A arbitrary code execution.

This article is a list of text control characters or text control codes by index number in the Pokémon games. Control characters represent a text function or tell the game to print multiple characters rather than a single character.

In Generation I

In-text

Bulbapedia also has an article about List of text control codes.
  • 00: Prints an error code if in the middle of a text box. The message will be "(X) ERROR" in Red/Blue or "(X) error" in Pokémon Yellow, where (x) is the 'ID' of the text box (which will have been stored in an address such as FF8C or CF13). The message ends and all text after the error code is not printed.
  • 49: New message box page and new text is brought up possibly over the text box.
  • 4A: "PKMN"
  • 4B: New message box page + effect of character $4C (13 frames)
  • 4C: Scroll text up (10 frames)
  • 4E: Move down one or two lines
  • 50: End of name marker
  • 51: New message box page (23 frames)
  • 52: (Player's name)
  • 53: (Rival's name)
  • 54: *POKé" (ポケモン in Japanese versions)
  • 55: New message box page + ₽4C (13 frames)
  • 56: …… (two characters)
  • 57: ('full' terminator)
  • 58: New message box page + (terminator)
  • 59: wBattleMonNick if enemy turn, wEnemyMonNick if player turn
  • 5A: wEnemyMonNick if enemy turn, wBattleMonNick if player turn
  • 5B: "PC" (パソコン, Pasokon in Japanese versions)
  • 5C: "TM" (わざマシン, Waza Machine in Japanese versions)
  • 5D: "TRAINER" (トレーナー in Japanese versions)
  • 5E: "ROCKET" (ロケットだん, Rocket-dan in Japanese versions)
  • 5F: . (and terminator) (Japanese Pokédex entries only)

Text commands

Unlike in-text control characters, text commands appear at the start of referenced text. They can be found in strings such as NPC dialogue or Pokédex entries. For further information, see here.

 Does not use glitches that allow writing to an arbitrary destination. The text engine has capability to do this, using the unused command 0x03 to repoint the destination to theoretically any address, then by using the string engine to print text to the specified destination. However, it is unable to write completely arbitrary values as some values are used as "control codes" which do alternate functions that do not result in the byte being written. The invalid mart used in LWA does not fall under this as the destination address of the corruption is fixed, while the source is arbitrarily specifiable. 
  • 04: TX_BOX (Print a text box; specify the address of upper-left corner and the height, width)
  • 05: TX_LOW (Needs better documentation)
  • 06: TX_PROMPT_BUTTON (Needs better documentation)
  • 07: TX_SCROLL (Needs better documentation)
  • 08: TX_START_ASM (Run ASM following the 08 byte (can be used for arbitrary code execution))
  • 09: TX_NUM (Print a big-endian decimal number)
  • 0A: TX_PAUSE (Needs better documentation)
  • 0B: TX_SOUND_GET_ITEM_1
  • 0C: TX_DOTS (Draw n ellipsis)
  • 0D: TX_WAIT_BUTTON (Needs better documentation)
  • 0E: TX_SOUND_POKEDEX_RATING
  • 0F: TX_SOUND_GET_ITEM_1_DUPLICATE
  • 10: TX_SOUND_GET_ITEM_2
  • 11: TX_SOUND_GET_KEY_ITEM
  • 12: TX_SOUND_CAUGHT_MON
  • 13: TX_SOUND_DEX_PAGE_ADDED
  • 14: TX_SOUND_CRY_NIDORINA
  • 15: TX_SOUND_CRY_PIDGEOT
  • 16: TX_SOUND_CRY_DEWGONG
  • 17: TX_FAR (Run text commands from another address). The format is (pointer, big endian) (bank).
  • F5: Loads a vending machine
  • F6: Loads Cable Club reception lady text
  • F7: Game Corner Pokémon prize menu. The prizes are determined by the text box's index number, stored at FF8C. Some glitch Game Corner prizes also cause buffer overflows. See PrizeDex for more information.
  • F9: Normal PC (Pokémon Center)
  • FC: PC for items only (Player's PC)
  • FD: PC for Pokémon storage only (unused, featuring "Switch on!" text, appears in an inaccessible Bill's house script)
  • FE: Loads a Poké Mart
  • FF: Loads a Pokémon Center

See also

TextCommandJumpTable::
; entries correspond to TX_* constants (see macros/scripts/text.asm)
	dw TextCommand_START         ; TX_START
	dw TextCommand_RAM           ; TX_RAM
	dw TextCommand_BCD           ; TX_BCD
	dw TextCommand_MOVE          ; TX_MOVE
	dw TextCommand_BOX           ; TX_BOX
	dw TextCommand_LOW           ; TX_LOW
	dw TextCommand_PROMPT_BUTTON ; TX_PROMPT_BUTTON
IF DEF(_DEBUG)
	dw _ContTextNoPause          ; TX_SCROLL
ELSE
	dw TextCommand_SCROLL        ; TX_SCROLL
ENDC
	dw TextCommand_START_ASM     ; TX_START_ASM
	dw TextCommand_NUM           ; TX_NUM
	dw TextCommand_PAUSE         ; TX_PAUSE
	dw TextCommand_SOUND         ; TX_SOUND_GET_ITEM_1 (also handles other TX_SOUND_* commands)
	dw TextCommand_DOTS          ; TX_DOTS
	dw TextCommand_WAIT_BUTTON   ; TX_WAIT_BUTTON

Special text IDs

There are six special text IDs which always result in the same message box. They can be manipulated with text box ID matching by setting up the Trainer escape glitch and having CF13 as one of the following values.

  • 00 - Open the Start menu (what players are expected to do before returning to the route)
  • D0 - Displays "[$CD6D] fainted!" but seemingly doesn't actually faint a Pokémon. There are numerous interactions which will update CD6D, such as Flying (displaying [Town Map name] fainted!) and having previously fought a Trainer (displaying [Trainer name] fainted!) but assuming it is possible to keep CF13 as D0. (If the player wanted, they could also use arbitrary code execution to write a custom message at CD6D)
  • D1 - Displays "[PLAYER NAME] is out of useable POKéMON! RED blacked out!" but doesn't actually black out Red.
  • D2 - Displays the message "REPEL's effect wore off." but seemingly doesn't actually affect Repel steps.
  • D3 - Displays the message "PA: Your SAFARI GAME is over!" but doesn't actually warp Red to the Safari Zone gate.
  • D4 - Brings up Pikachu's emotion box with Pikachu's current emotion. If done during the Trainer escape glitch (possible by simply talking to Pikachu immediately before returning to the route), it brings up a blank text box as well. This ID is exclusive to Pokémon Yellow. It will also work even if the player never obtained a Pikachu by adjusting a meta-map script to 01 for a route with Trainers, and the emotion may be as if the player just obtained Pikachu. [1][2]

In Generation II

In text

Bulbapedia also has an article about List of text control codes.
  • 00: Prints an error code with the original Japanese string エラー (mojibake "Df-" in English versions; unlike Generation I this was not translated into "error").
  • 14: Player's name and Japanese gendered honorific (くん for males, ちゃん for females).
  • 15: Mobile script for Mobile System GB in Japanese Pokémon Crystal; followed by a parameter ranging from 0x01-0x10, but due to an oversight the invalid script 15 00 is possible, allowing for 0x1500 control code arbitrary code execution. Additionally, mobile scripts were brought over to the English version of Pokémon Crystal.
  • 18: "ノ゛" ("no" with a dakuten; ungrammatical)
  • 1D: "に " ("ni" particle, ";" outside of Japan).
  • 1E: "って" ("tte" in て form speech, "[" outside of Japan).
  • 1F: "を" ("wo", " " outside of Japan).
  • 22: た! (past tense speech with !; half-line break outside of Japan)
  • 23: こうげき (meaning "attack", but appears as the mojibake "tzx" outside of Japan).
  • 24: "は " ("PoKé" outside of Japan)
  • 25: "の " ("no" particle)
  • 35: ばん どうろ ("-ban douro"; used in route names, contextually it is like "route [x]" but in Japanese versions this would be [x]ばん どうろ )
  • 36: わたし ("watashi"; the pronoun "I")
  • 37: ここは ("koko wa"; meaning "here is(...)")
  • 38: レッド ("Red")
  • 39: グリーン ("Green")
  • 3F: Opposing Trainer's name (including Trainer class)
  • 49 (unused?): Mother's name, typically "MOM" (おかあさん) which is initialised after a new game (but is really D1AE (English Gold/Silver address)). In development it was possible to rename her. This feature did not make it into the final games. D1AE is also used for temporary space during the Dude's catching demonstration to store the player's name (similar to what the old man does in Generation I). Once overwritten, the player's name remains in this space.
  • 4A: が ("ga" particle, PKMN outside of Japan).

Event scripts

Main article: Generation II event scripts

Used for interactions with NPCs, people and special events. These also apply to Pokégear scripts, and may be used by glitch contacts.[3]

  • 00 = Pointer code [2b+ret]
  • 01 = Pointer code [3b+ret]
  • 02 = Pointer code [2b+3b+ret]
  • 03 = Pointer code [2b]
  • 04 = Pointer code [3b]
  • 05 = Pointer code [2b+3b]
  • 06 = RAM check [=byte]
  • 07 = RAM check [<>byte]
  • 08 = RAM check [=0]
  • 09 = RAM check [<>0]
  • 0A = RAM check [<byte]
  • 0B = RAM check [>byte]
  • 0C = 0C codes [xxyy]
  • 0D = 0D codes [xxyy]
  • 0E = ASM code1 [3b]
  • 0F = 0F codes [xxyy]
  • 10 = ASM code2 [2b]
  • 11 = Trigger event check1 [xxyy]
  • 12 = Activate trigger event from afar [xxyyzz]
  • 13 = Trigger event check
  • 14 = De-/activate trigger event [xx]
  • 15 = Load variable into RAM [xx]
  • 16 = Add variables [xx]
  • 17 = Random number [xx]
  • 18 = Version check
  • 19 = Copy variable code1 [xxyy]
  • 1A = Copy variable code2 [xxyy]
  • 1B = Load variable [xxyyzz]
  • 1C = Check codes [xx]
  • 1D = Input code1 [xx]
  • 1E = Input code2 [xxyy]
  • 1F = Give item code [xxyy]
  • 20 = Take item code [xxyy]
  • 21 = Check for item code [xx]
  • 22 = Give money code [xxyyzzaa]
  • 23 = Take money code [xxyyzzaa]
  • 24 = Check for money code [xxyyzzaa]
  • 25 = Give coins code [xxyy]
  • 26 = Take coins code [xxyy]
  • 27 = Check for coins code [xxyy]
  • 28 = Give cell phone number [xx]
  • 29 = Take cell phone number [xx]
  • 2A = Check for cell phone number [xx]
  • 2B = Check time of day [xx]
  • 2C = Check for PKMN [xx]
  • 2D = Give PKMN [xxyyzzaa(+2b +2b)]
  • 2E = Give EGG [xxyy]
  • 2F = Attach item code [2B]
  • 30 = Check letter code [2b]
  • 31 = BitTable1 check [xxyy]
  • 32 = BitTable1 reset [xxyy]
  • 33 = BitTable1 set [xxyy]
  • 34 = BitTable2 check [xxyy]
  • 35 = BitTable2 reset [xxyy]
  • 36 = BitTable2 set [xxyy]
  • 37 = Deactivate PKMN battles
  • 38 = Activate PKMN battles
  • 39 = X/Y comparison [xxyy]
  • 3A = Warp modifier [xxyyzz]
  • 3B = Blackout modifier [xxyy]
  • 3C = Warp code [xxyyzzaa]
  • 3D = Account code [xxyy]
  • 3E = Coin case code [xx]
  • 3F = Display RAM [xx]
  • 40 = Display PokéMon name [xxyy]
  • 41 = Display item name [xxyy]
  • 42 = Display location name [xx]
  • 43 = Display trainer name [xxyyzz]
  • 44 = Display strings [2b + xx]
  • 45 = Stow away item code
  • 46 = Full item pocket code
  • 47 = Text box&font code
  • 48 = Refresh code [xx]
  • 49 = Load moving sprites
  • 4A = Load byte to C1CE [xx]
  • 4B = Display text [3b]
  • 4C = Display text [2b]
  • 4D = Repeat text [xxyy]
  • 4E = YES/No box
  • 4F = Menu data code [2b]
  • 50 = Write backup code
  • 51 = Text1 code [2b]
  • 52 = Text2 code [2b]
  • 53 = Close text box code
  • 54 = Keep text box open code
  • 55 = Pokémon picture code [xx]
  • 56 = Pokémon picture YES/NO code
  • 57 = Menu interpreter 1
  • 58 = Menu interpreter 2
  • 59 = Load Pikachu data
  • 5A = Delete FightRAM/reset person check
  • 5B = Load trainer data1
  • 5C = Load Pokémon data [xxyy]
  • 5D = Load trainer data2 [xxyy]
  • 5E = Start battle
  • 5F = Return to In game engine after battle
  • 60 = Learn how to catch PKMN [xx]
  • 61 = Trainer text code
  • 62 = Trainer status code [xx]
  • 63 = Pointer Win/Loss [2b + 2b]
  • 64 = Script talk-after
  • 65 = Script talk-after-cancel
  • 66 = Script talk-after-check
  • 67 = Set talked-to person [xx]
  • 68 = Moving code [xx + 2b]
  • 69 = Moving code for talked-to person [2b]
  • 6A = Talk-to facing code
  • 6B = Facing of people code [xxyy]
  • 6C = Variable sprites [xxyy]
  • 6D = Hide person [xx]
  • 6E = Show person [xx]
  • 6F = Following code1 [xxyy]
  • 70 = Stop following code
  • 71 = Move person [xxyyzz]
  • 72 = Write person location [xx]
  • 73 = Load emoticons [xx]
  • 74 = Display emoticon [xxyyzz]
  • 75 = Change facing [xxyy]
  • 76 = Following code2 [xxyy]
  • 77 = Earth quake [xx]
  • 78 = Exchange map [3b]
  • 79 = Change block code [xxyyzz]
  • 7A = Reload map code
  • 7B = Reload map part code
  • 7C = Write command queue
  • 7D = Delete command queue
  • 7E = Song code1 [xxyy]
  • 7F = Song code2
  • 80 = Music fade-out code [xxyy][zz]
  • 81 = Play map music code
  • 82 = Map reload music code
  • 83 = Cry code [xx00]
  • 84 = Sound code [xxyy]
  • 85 = Key-down code
  • 86 = Warp sound
  • 87 = Special sound
  • 88 = Engine remote control [2b]
  • 89 = Load map anew [xx]
  • 8A = Waiting code [xx]
  • 8B = Deactivate static facing [xx]
  • 8C = Priority jump1 [2b]
  • 8D = Warp check
  • 8E = Priority jump2 [2b]
  • 8F = Return code1
  • 90 = Return code2
  • 91 = Return code3
  • 92 = Reset sophisticated functions
  • 93 = Mart menu [xxyyzz]
  • 94 = Elevator menu [2b]
  • 95 = Trade menu [xx]
  • 96 = Give cell phone number with YES/NO [xx]
  • 97 = Call code [2b]
  • 98 = Hang-up code
  • 99 = Decoration code [xx]
  • 9A = Fruit tree code [xx]
  • 9B = Cell phone call code [xx00]
  • 9C = Check cell phone call code
  • 9D = Commented give item code [xxyy]
  • 9E = Load special wild PKMN data [xxyy]
  • 9F = Hall of Fame code
  • A0 = Credits code
  • A1 = Facing warp
  • A2 = MEMORY code [2b + Bank + xx]
  • A3 = Display any location name [xx]

References