• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

Research: Script Raws Compilation

Alexander Nicholi

what do you know about computing?
5,500
Posts
14
Years
This project is for collecting and compiling all of the raws used in standard scripts, movement sequences, and possibly text sequences (if applicable) for Ruby/Sapphire, FireRed/LeafGreen, and Emerald. All of the raws will be compiled into a standards-compliant XML sheet which could be used for implementation into ROM editing tools later on, and if not it can just be read as text in Notepad++ or whatever for reference. The scripting part of the XML contains the command's hex value, what it does, and a byte syntax formula; the movement-bytes section of the reference sheet contains the command's hex value and how it acts when executed; the text-sequence portion of the sheet hasn't been implemented yet (debatable).

I've found a lot of the values for R/S myself, but there is still a big amount of them I haven't discovered:
Identified script command bytes: 53 out of [assumedly] 255 (~21% complete)
Identified movement-sequence command bytes: 131 out of [assumedly] 255 (~51% complete)

I have the so-far-incomplete XML sheet for Ruby and Sapphire in the code below.
Code:
[div=font-family:Consolas;font-size:10pt;]<?xml version="1.0" encoding="ISO-8859-1"?>
<cat name="standardCommands" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.alextherose.ws/hexref.xsd">
	<!-- Standard script command list ordered by command byte -->
	<!-- For vars, number of curly brackets used = number of bytes occupied -->
	<cmd hex="0x02" def="end script" syn=""/>
	<cmd hex="0x03" def="return to parent script" syn=""/>
	<cmd hex="0x04" def="calls another script for execution" syn="04 {{{{script-ptr}}}}"/>
	<cmd hex="0x05" def="Jumps to offset via pointer" syn="05 {{{{jump-ptr}}}}" />
	<cmd hex="0x06" def="Checks two values stored by preceeding command, then jumps to ptr" syn="06 {type} {{{{jump-ptr}}}}"/>
	<cmd hex="0x09" use="callstd" syn="09 {byte}"/>
	<cmd hex="0x16" def="Sets variable with numerical value" syn="16 {{var}} {{val}}"/>
	<cmd hex="0x17" def="Adds two vars together" syn="17 {{var1}} {{var2}}"/>
	<cmd hex="0x18" def="Subtract one var from another var" syn="18 {{var1}} {{var2}}"/>
	<cmd hex="0x19" def="Copies value of one var to another var" syn="19 {{from}} {{to}}"/>
	<cmd hex="0x1A" def="Copies var if not zero" syn="1A {{from}} {{to}}"/>
	<cmd hex="0x1B" def="Compares values of two vars" syn="1B {{var1}} {{var2}}"/>
	<cmd hex="0x21" def="Compares two 16-bit integers" syn="21 {{num1}} {{num2}}"/>
	<cmd hex="0x25" def="Special command" syn="25 {{subcmd-id}}"/>
	<cmd hex="0x27" def="Waits for Special/Special2 command to finish" syn=""/>
	<cmd hex="0x28" def="Pauses script for fixed time; 0x20 ~ 1 sec" syn="28 {{time}}"/>
	<cmd hex="0x29" def="Sets flag to on pos" syn="29 {{flag-id}}"/>
	<cmd hex="0x2A" def="Clears flag to off pos" syn="2A {{flag-id}}"/>
	<cmd hex="0x2B" def="Checks on/off pos of flag" syn="2B {{flag-id}}"/>
	<cmd hex="0x30" def="Initiates Pokemon cry" syn="30 {{pkmn-id}} "/>
	<cmd hex="0x33" def="Play audio sequence from music banks" syn="33 {{trackid}} 00"/>
	<cmd hex="0x39" def="Warps player to a warp event or x/y coordinates" syn="39 {{bank}} {{map}} [1;{{warp}}|FF] {{x-pos*}} {{y-pos*}}"/> <!-- * = Only if [1] is 0xFF -->
	<cmd hex="0x43" def="Counts Pokemon in party and stores value in var 0x800D"/>
	<cmd hex="0x45" def="Removes one or more items of same id from bag" syn="45 {{item-id}} {{amt}}"/>
	<cmd hex="0x47" def="Checks existence of item in bag" syn="47 {{item-id}} {{amt}}"/>
	<cmd hex="0x4A" def="Checks existence of item in PC" syn="4A {{item-id}} {{amt}}"/>
	<cmd hex="0x4F" def="Apply movement to person evt" syn="4F {{evt-id}} {{{{movedata}}}}"/>
	<cmd hex="0x51" def="Pause script until current commands finish" syn="51 00 00"/>
	<cmd hex="0x53" def="Makes person evt disappear from map" syn="53 {{evt-id}}"/>
	<cmd hex="0x55" def="Makes person evt reappear on map" syn="55 {{evt-id}}"/>
	<cmd hex="0x57" def="Moves person evt to location instantly" syn="57 {{evt-id}} {{x-pos}} {{y-pos}}"/>
	<cmd hex="0x5A" def="Forces person evt to face towards player" syn=""/>
	<cmd hex="0x5C" def="Initiates trainer battle" syn="5C {type} {{t-id}} 00 00 {{{{intromsg-ptr}}}} {{{{defeatmsg-ptr*}}}} {{{{continuescr-ptr**}}}}"/> <!-- * = Only if {type} is 0x0 or 0x1 --><!-- ** = Only if {type} = 0x1 -->
	<cmd hex="0x66" def="Shows message invoked by 0x67" syn=""/>
	<cmd hex="0x67" def="Display text from offset" syn="67 {{{{textdata}}}}"/>
	<cmd hex="0x68" def="Closes message invoked by 0x66 or 0x67 commands" syn=""/>
	<cmd hex="0x69" def="Locks all person evts on map in place" syn=""/>
	<cmd hex="0x6A" def="Locks in place person evt being interacted with" syn="" />
	<cmd hex="0x6B" def="Unlocks all person evts on map" syn=""/>
	<cmd hex="0x6C" def="Unlocks from place person evt being interacted with" syn=""/>
	<cmd hex="0x6D" def="Waits for player to press a button to continue" syn=""/>
	<cmd hex="0x79" def="Adds one Pokemon to party; must be followed by a valid 0x7D cmd" syn="79 {{pkmn-id}} {level} {{item-id}} 00 00 00 00 00 00 00 00 00"/>
	<cmd hex="0x7A" def="Gives player 1 egg" syn="7A {{pkmn-id}}"/>
	<cmd hex="0x7D" def="Stores Pokemon created by cmd 0x79 in party" syn="7D 00 {{pkmn-id}}"/>
	<cmd hex="0x86" def="Displays PokeMart data from offset" syn="86 {{{{martdata}}}}"/>
	<cmd hex="0x8F" def="Picks random number between 0x00 and specified number and stores in 0x800D" syn="8F {{num}}"/>
	<cmd hex="0x97" def="Fade screen to/from black/white" syn="97 {fadetype}"/>
	<cmd hex="0xA0" def="Checks player gender and stores value in 0x800D" syn=""/>
	<cmd hex="0xA2" def="Sets map tiles and/or movement permissions until reloaded" syn="A2 {{x-pos}} {{y-pos}} {{tileno}} {{passable}}"/>
	<cmd hex="0xA3" def="resets weather conditions to default value in map header" syn=""/>
	<cmd hex="0xA4" def="Sets weather type to be initiated by cmd 0xA5; see A-Map for weather vals" syn="A4 {weather-id}"/>
	<cmd hex="0xA5" def="Activates weather code set by cmd cmd 0xA4" syn=""/>
	<cmd hex="0xB6" def="Initiates wild Pokemon battle" syn="B6 {{poke-id}} {level} {{item-id}}"/>
	<cmd hex="0xC5" def="Waits for cry command to finish playing" syn=""/>
</cat>
<cat name="commandOptionBytes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.alextherose.ws/hexref.xsd">
	<!-- Command byte value options (for specific commands) -->
	<op cmd="0x06">
		<!-- Compare byte options for if-then-jump command -->
		<val var="type" hex="0x00" def="<"/>
		<val var="type" hex="0x01" def="=="/>
		<val var="type" hex="0x02" def=">"/>
		<val var="type" hex="0x03" def="<="/>
		<val var="type" hex="0x04" def=">="/>
		<val var="type" hex="0x05" def="!="/>
	</op>
	<op cmd="0x09">
		<!-- Message types for 2nd byte of callstd -->
		<val var="byte" hex="0x00" def="MSG OBTAIN"/>
		<val var="byte" hex="0x01" def="MSG FIND"/>
		<val var="byte" hex="0x02" def="MSG STANDARD"/>
		<val var="byte" hex="0x03" def="MSG SIGN"/>
		<val var="byte" hex="0x04" def="MSG NOCLOSE"/>
		<val var="byte" hex="0x05" def="MSG YESNO"/>
		<val var="byte" hex="0x06" def="MSG NORMAL"/>
	</op>
	<op cmd="0x5C">
		<!-- Options for trainerbattle command -->
		<val var="type" hex="0x00" def="Normal trainer battle"/>
		<val var="type" hex="0x01" def="Normal w/ scr continuation"/>
		<val var="type" hex="0x03" def="Normal w/o defeat scr"/>
	</op>
	<op cmd="0x97">
		<!-- Types of screen fades for 2nd byte of fadescreen -->
		<val var="fadetype" hex="0x0" def="Black to normal"/>
		<val var="fadetype" hex="0x1" def="Normal to black"/>
		<val var="fadetype" hex="0x2" def="White to normal"/>
		<val var="fadetype" hex="0x3" def="Normal to white"/>
	</op>
	<op cmd="0xA2">
		<val var="passable" hex="0x0" def="Passable"/>
		<val ver="passable" hex="0x1" def="Not passable"/>
	</op>
</cat>
<cat name="movementCodes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://www.alextherose.ws/hexref.xsd">
	<!-- List of move bytes for Ruby/Sapphire -->
	<!-- Commented "?" indicates duplicate questionability -->
	<m hex="0x00" name="Face down"/>
	<m hex="0x01" name="Face up"/>
	<m hex="0x02" name="Face left"/>
	<m hex="0x03" name="Face right"/>
	<m hex="0x04" name="Step down (0.5x)"/>
	<m hex="0x05" name="Step up (0.5x)"/>
	<m hex="0x06" name="Step left (0.5x)"/>
	<m hex="0x07" name="Step right (0.5x)"/>
	<m hex="0x08" name="Step down (1x)"/>
	<m hex="0x09" name="Step up (1x)"/>
	<m hex="0x0A" name="Step left (1x)"/>
	<m hex="0x0B" name="Step right (1x)"/>
	<m hex="0x0C" name="Jump ledge 2 (down)"/>
	<m hex="0x0D" name="Jump ledge 2 (up)"/>
	<m hex="0x0E" name="Jump ledge 2 (left)"/>
	<m hex="0x0F" name="Jump ledge 2 (right)"/>
	<m hex="0x10" name="Pause #1"/>
	<m hex="0x11" name="Pause #2"/>
	<m hex="0x12" name="Pause #3"/>
	<m hex="0x13" name="Pause #4"/>
	<m hex="0x14" name="Pause #5"/>
	<m hex="0x15" name="Step down (2x)"/>
	<m hex="0x16" name="Step up (2x)"/>
	<m hex="0x17" name="Step left (2x)"/>
	<m hex="0x18" name="Step right (2x)"/>
	<m hex="0x19" name="Step on-the-spot (down) (0.5x)"/>
	<m hex="0x1A" name="Step on-the-spot (up) (0.5x)"/>
	<m hex="0x1B" name="Step on-the-spot (left) (0.5x)"/>
	<m hex="0x1C" name="Step on-the-spot (right) (0.5x)"/>
	<m hex="0x1D" name="Step on-the-spot (down) (1x)"/>
	<m hex="0x1E" name="Step on-the-spot (up) (1x)"/>
	<m hex="0x1F" name="Step on-the-spot (left) (1x)"/>
	<m hex="0x20" name="Step on-the-spot (right) (1x)"/>
	<m hex="0x21" name="Step on-the-spot (down) (2x)"/>
	<m hex="0x22" name="Step on-the-spot (up) (2x)"/>
	<m hex="0x23" name="Step on-the-spot (left) (2x)"/>
	<m hex="0x24" name="Step on-the-spot (right) (2x)"/>
	<m hex="0x25" name="Step on-the-spot (down) (4x)"/>
	<m hex="0x26" name="Step on-the-spot (up) (4x)"/>
	<m hex="0x27" name="Step on-the-spot (left) (4x)"/>
	<m hex="0x28" name="Step on-the-spot (right) (4x)"/>
	<m hex="0x29" name="Slide down (0.5x)"/>
	<m hex="0x2A" name="Slide up (0.5x)"/>
	<m hex="0x2B" name="Slide left (0.5x)"/>
	<m hex="0x2C" name="Slide right (0.5x)"/>
	<m hex="0x2D" name="Slide down (1x)"/>
	<m hex="0x2E" name="Slide up (1x)"/>
	<m hex="0x2F" name="Slide left (1x)"/>
	<m hex="0x30" name="Slide right (1x)"/>
	<m hex="0x31" name="Slide down (2x)"/>
	<m hex="0x32" name="Slide up (2x)"/>
	<m hex="0x33" name="Slide left (2x)"/>
	<m hex="0x34" name="Slide right (2x)"/>
	<m hex="0x35" name="Slide down (running)"/>
	<m hex="0x36" name="Slide up (running)"/>
	<m hex="0x37" name="Slide left (running)"/>
	<m hex="0x38" name="Slide right (running)"/>
	<m hex="0x3A" name="Jump facing left (down)"/>
	<m hex="0x3B" name="Jump facing down (up)"/>
	<m hex="0x3C" name="Jump facing up (left)"/>
	<m hex="0x3D" name="Jump facing left (right)"/>
	<m hex="0x3E" name="Face towards player"/>
	<m hex="0x3F" name="Face away from player"/>
	<m hex="0x40" name="Lock sprite-facing"/>
	<m hex="0x41" name="Release sprite-facing"/>
	<m hex="0x42" name="Jump ledge (down)"/>
	<m hex="0x43" name="Jump ledge (up)"/>
	<m hex="0x44" name="Jump ledge (left)"/>
	<m hex="0x45" name="Jump ledge (right)"/>
	<m hex="0x46" name="Jump on-the-spot (facing down)"/>
	<m hex="0x47" name="Jump on-the-spot (facing up"/>
	<m hex="0x48" name="Jump on-the-spot (facing left)"/>
	<m hex="0x49" name="Jump on-the-spot (facing right)"/>
	<m hex="0x4A" name="Jump on-the-spot (facing down/up)"/>
	<m hex="0x4B" name="Jump on-the-spot (facing up/down)"/>
	<m hex="0x4C" name="Jump on-the-spot (facing left/right)"/>
	<m hex="0x4D" name="Jump on-the-spot (facing right/left)"/>
	<m hex="0x4E" name="Face left"/> <!--?-->
	<m hex="0x54" name="Hide sprite"/>
	<m hex="0x55" name="Show sprite"/>
	<m hex="0x56" name="Exclamation mark bubble"/>
	<m hex="0x57" name="Question mark bubble"/>
	<m hex="0x58" name="Heart bubble"/>
	<m hex="0x62" name="Walk down"/> <!--?-->
	<m hex="0x63" name="Walk down"/> <!--?-->
	<m hex="0x64" name="Face down (delayed)"/>
	<m hex="0x65" name="Face up (delayed)"/>
	<m hex="0x66" name="Face left (delayed)"/>
	<m hex="0x67" name="Face right (delayed)"/>
	<m hex="0x70" name="Jump on-the-spot (facing down)"/> <!--?-->
	<m hex="0x71" name="Jump on-the-spot (facing up)"/> <!--?-->
	<m hex="0x72" name="Jump on-the-spot (facing left)"/> <!--?-->
	<m hex="0x73" name="Jump on-the-spot (facing right)"/> <!--?-->
	<m hex="0x74" name="Jump down (running)"/>
	<m hex="0x75" name="Jump up (running)"/>
	<m hex="0x76" name="Jump left (running)"/>
	<m hex="0x77" name="Jump right (running)"/>
	<m hex="0x78" name="Jump down 2 (running)"/>
	<m hex="0x79" name="Jump up 2 (running)"/>
	<m hex="0x7A" name="Jump left 2 (running)"/>
	<m hex="0x7B" name="Jump right 2 (running)"/>
	<m hex="0x7C" name="Walk on-the-spot (down)"/> <!--?-->
	<m hex="0x7D" name="Walk on-the-spot (up)"/> <!--?-->
	<m hex="0x7E" name="Walk on-the-spot (left)"/> <!--?-->
	<m hex="0x7F" name="Walk on-the-spot (right)"/> <!--?-->
	<m hex="0x80" name="Slide down (running)"/> <!--?-->
	<m hex="0x81" name="Slide up (running)"/> <!--?-->
	<m hex="0x82" name="Slide left (running)"/> <!--?-->
	<m hex="0x83" name="Slide right (running)"/> <!--?-->
	<m hex="0x84" name="Slide down"/> <!--?-->
	<m hex="0x85" name="Slide up"/> <!--?-->
	<m hex="0x86" name="Slide left"/> <!--?-->
	<m hex="0x87" name="Slide right"/> <!--?-->
	<m hex="0x88" name="Slide down on left foot"/>
	<m hex="0x89" name="Slide up on left foot"/>
	<m hex="0x8A" name="Slide left on left foot"/>
	<m hex="0x8B" name="Slide right on feft foot"/>
	<m hex="0x8C" name="Slide left diagonally (facing up)"/>
	<m hex="0x8D" name="Slide right diagonally (facing up)"/>
	<m hex="0x8E" name="Slide left diagonally (facing down)"/>
	<m hex="0x8F" name="Slide right diagonally (facing down)"/>
	<m hex="0x90" name="Slide left diagonally 2 (facing up)"/>
	<m hex="0x91" name="Slide right diagonally 2 (facing up)"/>
	<m hex="0x92" name="Slide left diagonally 2 (facing down)"/>
	<m hex="0x93" name="Slide right diagonally 2 (facing down)"/>
	<m hex="0x96" name="Walk left"/> <!--?-->
	<m hex="0x97" name="Walk right"/> <!--?-->
	<m hex="0x98" name="Levitate"/>
	<m hex="0x99" name="Stop levitating"/>
	<m hex="0x9C" name="Zoom up vertically"/>
	<m hex="0x9D" name="Disembark"/>
	<m hex="0xFE" name="End movement sequence"/>
</cat>[/div]
(There is a copy of this code in an attachment below)

The XML schema for all sheets of this project is already set up and saved to my domain for ease of access. Thus, the xsi:noNamespaceSchemaLocation attribute inside <cat> elements generally shouldn't be modified.

If you spot an error, don't hesitate to point it out. If you've found any raws that aren't in the document yet, please share them with the project.
 

Alexander Nicholi

what do you know about computing?
5,500
Posts
14
Years
Some people prefer other script editors over XSE (surprisingly), and even those who have and/or use it might not want to have to drag it out to check what bytes do what, for instance with scripting in hex.

Besides, I'm not one of those people that like to credit people for things (kinda makes me look unoriginal), so I don't plan on taking what HackMew has built up.
 

tinix

PearlShipper & C Programmer
86
Posts
14
Years
I have all raws (command list) exported from XSE somewhere, if you want them i can upload them
 
Last edited:
5,256
Posts
16
Years
Some people prefer other script editors over XSE (surprisingly), and even those who have and/or use it might not want to have to drag it out to check what bytes do what, for instance with scripting in hex.

Besides, I'm not one of those people that like to credit people for things (kinda makes me look unoriginal), so I don't plan on taking what HackMew has built up.

To be fair, XSE tells you what hex code the command is, how many bytes it needs, how many parameters are needed and everything. Sorry! D:
 

droomph

weeb
4,285
Posts
12
Years
@Spherical Um but commands like lighten and darken really need to be explained more (and commands like setpokepp are wrong in their explanation) and here's a great way to explain to everyone what commands like that do.

Besides I find the layout in XSE to be messy so here's a chance for him to start changing that trend.
 
Back
Top