1669 lines
44 KiB
PHP
Raw Normal View History

2016-09-02 19:51:16 -07:00
@ Does nothing.
2018-01-18 12:53:31 -05:00
.macro nop
2015-10-19 09:42:57 -07:00
.byte 0x00
.endm
2016-09-02 19:51:16 -07:00
@ Does nothing.
2018-01-18 12:53:31 -05:00
.macro nop1
2015-10-19 09:42:57 -07:00
.byte 0x01
.endm
2016-09-02 19:51:16 -07:00
@ Terminates script execution.
2018-01-18 12:53:31 -05:00
.macro end
2015-10-19 09:42:57 -07:00
.byte 0x02
.endm
2016-09-02 19:51:16 -07:00
@ Jumps back to after the last-executed call statement, and continues script execution from there.
2018-01-18 12:53:31 -05:00
.macro return
2015-10-19 09:42:57 -07:00
.byte 0x03
.endm
2016-09-02 19:51:16 -07:00
@ Jumps to destination and continues script execution from there. The location of the calling script is remembered and can be returned to later.
2018-12-02 19:24:06 +01:00
.macro call destination:req
2015-10-19 09:42:57 -07:00
.byte 0x04
.4byte \destination
.endm
2016-09-02 19:51:16 -07:00
@ Jumps to destination and continues script execution from there.
2018-12-02 19:24:06 +01:00
.macro goto destination:req
2015-10-19 09:42:57 -07:00
.byte 0x05
.4byte \destination
.endm
2016-09-02 19:51:16 -07:00
@ If the result of the last comparison matches condition (see Comparison operators), jumps to destination and continues script execution from there.
2018-12-02 19:24:06 +01:00
.macro goto_if condition:req, destination:req
2015-10-19 09:42:57 -07:00
.byte 0x06
.byte \condition
.4byte \destination
.endm
2016-09-02 19:51:16 -07:00
@ If the result of the last comparison matches condition (see Comparison operators), calls destination.
2018-12-02 19:24:06 +01:00
.macro call_if condition:req, destination:req
2015-10-19 09:42:57 -07:00
.byte 0x07
.byte \condition
.4byte \destination
.endm
2016-09-02 19:51:16 -07:00
@ Jumps to the standard function at index function.
2018-12-02 19:24:06 +01:00
.macro gotostd function:req
2015-10-19 09:42:57 -07:00
.byte 0x08
.byte \function
.endm
@ callstd function names
STD_OBTAIN_ITEM = 0
STD_FIND_ITEM = 1
STD_OBTAIN_DECORATION = 7
STD_REGISTER_MATCH_CALL = 8
2016-09-02 19:51:16 -07:00
@ Calls the standard function at index function.
2018-12-02 19:24:06 +01:00
.macro callstd function:req
2015-10-19 09:42:57 -07:00
.byte 0x09
.byte \function
.endm
2016-09-02 19:51:16 -07:00
@ If the result of the last comparison matches condition (see Comparison operators), jumps to the standard function at index function.
2018-12-02 19:24:06 +01:00
.macro gotostd_if condition:req, function:req
2015-10-19 09:42:57 -07:00
.byte 0x0a
.byte \condition
.byte \function
.endm
2016-09-02 19:51:16 -07:00
@ If the result of the last comparison matches condition (see Comparison operators), calls the standard function at index function.
2018-12-02 19:24:06 +01:00
.macro callstd_if condition:req, function:req
2015-10-19 09:42:57 -07:00
.byte 0x0b
.byte \condition
.byte \function
.endm
2016-09-02 19:51:16 -07:00
@ Executes a script stored in a default RAM location.
.macro returnram
2015-10-19 09:42:57 -07:00
.byte 0x0c
.endm
2016-09-02 19:51:16 -07:00
@ Terminates script execution and "resets the script RAM".
2018-01-18 12:53:31 -05:00
.macro killscript
2015-10-19 09:42:57 -07:00
.byte 0x0d
.endm
2017-10-23 21:18:49 -05:00
@ Sets some status related to Mystery Event.
2018-12-02 19:24:06 +01:00
.macro setmysteryeventstatus value:req
2015-10-19 09:42:57 -07:00
.byte 0x0e
.byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Sets the specified script bank to value.
2018-12-02 19:24:06 +01:00
.macro loadword destination:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x0f
.byte \destination
.4byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Sets the specified script bank to value.
2018-12-02 19:24:06 +01:00
.macro loadbyte destination:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x10
.byte \destination
.byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Sets the byte at offset to value.
2018-12-02 19:24:06 +01:00
.macro writebytetoaddr value:req, offset:req
2015-10-19 09:42:57 -07:00
.byte 0x11
.byte \value
.4byte \offset
.endm
2016-09-02 19:51:16 -07:00
@ Copies the byte value at source into the specified script bank.
2018-12-02 19:24:06 +01:00
.macro loadbytefromaddr destination:req, source:req
2015-10-19 09:42:57 -07:00
.byte 0x12
.byte \destination
.4byte \source
.endm
2016-09-02 19:51:16 -07:00
@ Not sure. Judging from XSE's description I think it takes the least-significant byte in bank source and writes it to destination.
2018-12-02 19:24:06 +01:00
.macro setptrbyte source:req, destination:req
2015-10-19 09:42:57 -07:00
.byte 0x13
.byte \source
.4byte \destination
.endm
2016-09-02 19:51:16 -07:00
@ Copies the contents of bank source into bank destination.
2018-12-02 19:24:06 +01:00
.macro copylocal destination:req, source:req
2015-10-19 09:42:57 -07:00
.byte 0x14
.byte \destination
.byte \source
.endm
2016-09-02 19:51:16 -07:00
@ Copies the byte at source to destination, replacing whatever byte was previously there.
2018-12-02 19:24:06 +01:00
.macro copybyte destination:req, source:req
2015-10-19 09:42:57 -07:00
.byte 0x15
.4byte \destination
.4byte \source
.endm
2016-09-02 19:51:16 -07:00
@ Changes the value of destination to value.
2018-12-02 19:24:06 +01:00
.macro setvar destination:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x16
.2byte \destination
.2byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Changes the value of destination by adding value to it. Overflow is not prevented (0xFFFF + 1 = 0x0000).
2018-12-02 19:24:06 +01:00
.macro addvar destination:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x17
.2byte \destination
.2byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Changes the value of destination by subtracting value to it. Overflow is not prevented (0x0000 - 1 = 0xFFFF).
2018-12-02 19:24:06 +01:00
.macro subvar destination:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x18
.2byte \destination
.2byte \value
.endm
2016-09-02 19:51:16 -07:00
@ Copies the value of source into destination.
2018-12-02 19:24:06 +01:00
.macro copyvar destination:req, source:req
2015-10-19 09:42:57 -07:00
.byte 0x19
.2byte \destination
.2byte \source
.endm
2016-09-02 19:51:16 -07:00
@ If source is not a variable, then this function acts like setvar. Otherwise, it acts like copyvar.
2018-12-02 19:24:06 +01:00
.macro setorcopyvar destination:req, source:req
2015-10-19 09:42:57 -07:00
.byte 0x1a
.2byte \destination
.2byte \source
.endm
2016-09-02 19:51:16 -07:00
@ Compares the values of script banks a and b, after forcing the values to bytes.
2018-12-02 19:24:06 +01:00
.macro compare_local_to_local byte1:req, byte2:req
2015-10-19 09:42:57 -07:00
.byte 0x1b
.byte \byte1
.byte \byte2
.endm
2016-09-02 19:51:16 -07:00
@ Compares the least-significant byte of the value of script bank a to a fixed byte value (b).
2018-12-02 19:24:06 +01:00
.macro compare_local_to_value a:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x1c
.byte \a
.byte \b
.endm
2016-09-02 19:51:16 -07:00
@ Compares the least-significant byte of the value of script bank a to the byte located at offset b.
2018-12-02 19:24:06 +01:00
.macro compare_local_to_addr a:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x1d
.byte \a
.4byte \b
.endm
2016-09-02 19:51:16 -07:00
@ Compares the byte located at offset a to the least-significant byte of the value of script bank b.
2018-12-02 19:24:06 +01:00
.macro compare_addr_to_local a:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x1e
.4byte \a
.byte \b
.endm
2016-09-02 19:51:16 -07:00
@ Compares the byte located at offset a to a fixed byte value (b).
2018-12-02 19:24:06 +01:00
.macro compare_addr_to_value a:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x1f
.4byte \a
.byte \b
.endm
2016-09-02 19:51:16 -07:00
@ Compares the byte located at offset a to the byte located at offset b.
2018-12-02 19:24:06 +01:00
.macro compare_addr_to_addr a:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x20
.4byte \a
.4byte \b
.endm
2017-10-23 21:18:49 -05:00
@ Compares the value of `var` to a fixed word value (b).
2018-12-02 19:24:06 +01:00
.macro compare_var_to_value var:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0x21
2017-10-23 21:18:49 -05:00
.2byte \var
.2byte \value
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Compares the value of `var1` to the value of `var2`.
2018-12-02 19:24:06 +01:00
.macro compare_var_to_var var1:req, var2:req
2015-10-19 09:42:57 -07:00
.byte 0x22
2017-10-23 21:18:49 -05:00
.2byte \var1
.2byte \var2
2015-10-19 09:42:57 -07:00
.endm
@ Generic compare macro which attempts to deduce argument types based on their values
@ Any values between 0x4000 to 0x4FFF and 0x8000 to 0x8FFF are considered event variable identifiers
2018-12-02 19:24:06 +01:00
.macro compare arg1:req, arg2:req
.if ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && ((\arg2 >> 12) == 4 || (\arg2 >> 12) == 8)
compare_var_to_var \arg1, \arg2
.elseif ((\arg1 >> 12) == 4 || (\arg1 >> 12) == 8) && (\arg2 >= 0 && \arg2 <= 0xFFFF)
compare_var_to_value \arg1, \arg2
.else
.error "Invalid arguments for 'compare'"
.endif
.endm
2017-10-23 21:18:49 -05:00
@ Calls the native C function stored at `func`.
2018-12-02 19:24:06 +01:00
.macro callnative func:req
2015-10-19 09:42:57 -07:00
.byte 0x23
2017-10-23 21:18:49 -05:00
.4byte \func
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Replaces the script with the function stored at `func`. Execution returns to the bytecode script when func returns TRUE.
2018-12-02 19:24:06 +01:00
.macro gotonative func:req
2015-10-19 09:42:57 -07:00
.byte 0x24
2017-10-23 21:18:49 -05:00
.4byte \func
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Calls a special function; that is, a function designed for use by scripts and listed in a table of pointers.
2018-12-02 19:24:06 +01:00
.macro special function:req
2015-10-19 09:42:57 -07:00
.byte 0x25
2017-10-14 15:00:13 -04:00
.2byte SPECIAL_\function
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Calls a special function. That function's output (if any) will be written to the variable you specify.
2018-12-02 19:24:06 +01:00
.macro specialvar output:req, function:req
2015-10-19 09:42:57 -07:00
.byte 0x26
.2byte \output
2017-10-14 15:00:13 -04:00
.2byte SPECIAL_\function
2015-10-19 09:42:57 -07:00
.endm
2018-01-21 12:36:11 +01:00
@ temporary solution
2018-12-02 19:24:06 +01:00
.macro specialvar_ output:req, functionId:req
2018-01-21 12:36:11 +01:00
.byte 0x26
.2byte \output
.2byte \functionId
.endm
2015-10-19 09:42:57 -07:00
2016-09-02 19:51:16 -07:00
@ Blocks script execution until a command or ASM code manually unblocks it. Generally used with specific commands and specials. If this command runs, and a subsequent command or piece of ASM does not unblock state, the script will remain blocked indefinitely (essentially a hang).
2018-01-18 12:53:31 -05:00
.macro waitstate
2015-10-19 09:42:57 -07:00
.byte 0x27
.endm
2016-09-02 19:51:16 -07:00
@ Blocks script execution for time (frames? milliseconds?).
2018-12-02 19:24:06 +01:00
.macro delay time:req
2015-10-19 09:42:57 -07:00
.byte 0x28
.2byte \time
.endm
2016-09-02 19:51:16 -07:00
@ Sets a to 1.
2018-12-02 19:24:06 +01:00
.macro setflag a:req
2015-10-19 09:42:57 -07:00
.byte 0x29
.2byte \a
.endm
2016-09-02 19:51:16 -07:00
@ Sets a to 0.
2018-12-02 19:24:06 +01:00
.macro clearflag a:req
2015-10-19 09:42:57 -07:00
.byte 0x2a
.2byte \a
.endm
2016-09-02 19:51:16 -07:00
@ Compares a to 1.
2018-12-02 19:24:06 +01:00
.macro checkflag a:req
2015-10-19 09:42:57 -07:00
.byte 0x2b
.2byte \a
.endm
2017-10-23 21:18:49 -05:00
@ Initializes the RTC`s local time offset to the given hour and minute. In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro initclock hour:req, minute:req
2015-10-19 09:42:57 -07:00
.byte 0x2c
2017-10-23 21:18:49 -05:00
.2byte \hour
.2byte \minute
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Runs time based events. In FireRed, this command is a nop.
.macro dotimebasedevents
2015-10-19 09:42:57 -07:00
.byte 0x2d
.endm
2017-10-23 21:18:49 -05:00
@ Sets the values of variables 0x8000, 0x8001, and 0x8002 to the current hour, minute, and second. In FRLG, this command sets those variables to zero.
2018-01-18 12:53:31 -05:00
.macro gettime
2015-10-19 09:42:57 -07:00
.byte 0x2e
.endm
2016-09-02 19:51:16 -07:00
@ Plays the specified (sound_number) sound. Only one sound may play at a time, with newer ones interrupting older ones.
2018-12-02 19:24:06 +01:00
.macro playse sound_number:req
2015-10-19 09:42:57 -07:00
.byte 0x2f
.2byte \sound_number
.endm
2017-10-23 21:18:49 -05:00
@ Blocks script execution until the currently-playing sound (triggered by playse) finishes playing.
2018-01-18 12:53:31 -05:00
.macro waitse
2015-10-19 09:42:57 -07:00
.byte 0x30
.endm
2016-09-02 19:51:16 -07:00
@ Plays the specified (fanfare_number) fanfare.
2018-12-02 19:24:06 +01:00
.macro playfanfare fanfare_number:req
2015-10-19 09:42:57 -07:00
.byte 0x31
.2byte \fanfare_number
.endm
2016-09-02 19:51:16 -07:00
@ Blocks script execution until all currently-playing fanfares finish.
2018-01-18 12:53:31 -05:00
.macro waitfanfare
2015-10-19 09:42:57 -07:00
.byte 0x32
.endm
2016-09-02 19:51:16 -07:00
@ Plays the specified (song_number) song. The byte is apparently supposed to be 0x00.
2018-12-02 19:24:06 +01:00
.macro playbgm song_number:req, unknown:req
2015-10-19 09:42:57 -07:00
.byte 0x33
.2byte \song_number
.byte \unknown
.endm
2017-10-23 21:18:49 -05:00
@ Saves the specified (song_number) song to be played later.
2018-12-02 19:24:06 +01:00
.macro savebgm song_number:req
2015-10-19 09:42:57 -07:00
.byte 0x34
.2byte \song_number
.endm
2016-09-02 19:51:16 -07:00
@ Crossfades the currently-playing song into the map's default song.
2018-01-18 12:53:31 -05:00
.macro fadedefaultbgm
2015-10-19 09:42:57 -07:00
.byte 0x35
.endm
2016-09-02 19:51:16 -07:00
@ Crossfades the currently-playng song into the specified (song_number) song.
2018-12-02 19:24:06 +01:00
.macro fadenewbgm song_number:req
2015-10-19 09:42:57 -07:00
.byte 0x36
.2byte \song_number
.endm
2016-09-02 19:51:16 -07:00
@ Fades out the currently-playing song.
2018-12-02 19:24:06 +01:00
.macro fadeoutbgm speed:req
2015-10-19 09:42:57 -07:00
.byte 0x37
.byte \speed
.endm
2017-10-23 21:18:49 -05:00
@ Fades the previously-playing song back in.
2018-12-02 19:24:06 +01:00
.macro fadeinbgm speed:req
2015-10-19 09:42:57 -07:00
.byte 0x38
.byte \speed
.endm
2016-09-02 19:51:16 -07:00
@ Sends the player to Warp warp on Map bank.map. If the specified warp is 0xFF, then the player will instead be sent to (X, Y) on the map.
2018-12-02 19:24:06 +01:00
.macro warp map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x39
2017-10-23 21:18:49 -05:00
map \map
2015-10-19 09:42:57 -07:00
.byte \warp
.2byte \X
.2byte \Y
.endm
2016-09-02 19:51:16 -07:00
@ Clone of warp that does not play a sound effect.
2018-12-02 19:24:06 +01:00
.macro warpsilent map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x3a
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Clone of warp that plays a door opening animation before stepping upwards into it.
2018-12-02 19:24:06 +01:00
.macro warpdoor map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x3b
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Warps the player to another map using a hole animation.
2018-12-02 19:24:06 +01:00
.macro warphole map:req
2015-10-19 09:42:57 -07:00
.byte 0x3c
2017-10-23 21:18:49 -05:00
map \map
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Clone of warp that uses a teleport effect. It is apparently only used in R/S/E.
2018-12-02 19:24:06 +01:00
.macro warpteleport map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x3d
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the warp destination to be used later.
2018-12-02 19:24:06 +01:00
.macro setwarp map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x3e
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the warp destination that a warp to Warp 127 on Map 127.127 will connect to. Useful when a map has warps that need to go to script-controlled locations (i.e. elevators).
2018-12-02 19:24:06 +01:00
.macro setdynamicwarp map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x3f
2017-10-23 21:18:49 -05:00
map \map
2015-10-19 09:42:57 -07:00
.byte \warp
.2byte \X
.2byte \Y
.endm
2017-10-23 21:18:49 -05:00
@ Sets the destination that diving or emerging from a dive will take the player to.
2018-12-02 19:24:06 +01:00
.macro setdivewarp map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x40
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the destination that falling into a hole will take the player to.
2018-12-02 19:24:06 +01:00
.macro setholewarp map:req, warp:req, X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x41
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \X
.2byte \Y
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Retrieves the player's zero-indexed X- and Y-coordinates in the map, and stores them in the specified variables.
2018-12-02 19:24:06 +01:00
.macro getplayerxy X:req, Y:req
2015-10-19 09:42:57 -07:00
.byte 0x42
.2byte \X
.2byte \Y
.endm
2017-10-23 21:18:49 -05:00
@ Retrieves the number of Pokemon in the player's party, and stores that number in variable 0x800D (LASTRESULT).
2018-01-18 12:53:31 -05:00
.macro getpartysize
2015-10-19 09:42:57 -07:00
.byte 0x43
.endm
2016-09-02 19:51:16 -07:00
@ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and variable 0x800D (LASTRESULT) will be set to 0x0001; otherwise, LASTRESULT is set to 0x0000.
2018-12-02 19:24:06 +01:00
.macro giveitem index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x44
.2byte \index
.2byte \quantity
.endm
2016-09-02 19:51:16 -07:00
@ Removes quantity of item index from the player's Bag.
2018-12-02 19:24:06 +01:00
.macro takeitem index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x45
.2byte \index
.2byte \quantity
.endm
2016-09-02 19:51:16 -07:00
@ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room.
2018-12-02 19:24:06 +01:00
.macro checkitemspace index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x46
.2byte \index
.2byte \quantity
.endm
2016-09-02 19:51:16 -07:00
@ Checks if the player has quantity or more of item index in their Bag. Sets variable 0x800D (LASTRESULT) to 0x0001 if the player has enough of the item, or 0x0000 if they have fewer than quantity of the item.
2018-12-02 19:24:06 +01:00
.macro checkitem index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x47
.2byte \index
.2byte \quantity
.endm
2016-09-02 19:51:16 -07:00
@ Checks which Bag pocket the specified (index) item belongs in, and writes the value to variable 0x800D (LASTRESULT). This script is used to show the name of the proper Bag pocket when the player receives an item via callstd (simplified to giveitem in XSE).
2018-12-02 19:24:06 +01:00
.macro checkitemtype index:req
2015-10-19 09:42:57 -07:00
.byte 0x48
.2byte \index
.endm
2016-09-02 19:51:16 -07:00
@ Adds a quantity amount of item index to the player's PC. Both arguments can be variables.
2018-12-02 19:24:06 +01:00
.macro givepcitem index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x49
.2byte \index
.2byte \quantity
.endm
2016-09-02 19:51:16 -07:00
@ Checks for quantity amount of item index in the player's PC. Both arguments can be variables.
2018-12-02 19:24:06 +01:00
.macro checkpcitem index:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0x4a
.2byte \index
.2byte \quantity
.endm
2017-10-23 21:18:49 -05:00
@ Adds decoration to the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
2018-12-02 19:24:06 +01:00
.macro givedecoration decoration:req
2015-10-19 09:42:57 -07:00
.byte 0x4b
2017-10-23 21:18:49 -05:00
.2byte \decoration
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Removes a decoration from the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
2018-12-02 19:24:06 +01:00
.macro takedecoration decoration:req
2015-10-19 09:42:57 -07:00
.byte 0x4c
2017-10-23 21:18:49 -05:00
.2byte \decoration
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Checks for decoration in the player's PC. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
2018-12-02 19:24:06 +01:00
.macro checkdecor decoration:req
2015-10-19 09:42:57 -07:00
.byte 0x4d
2017-10-23 21:18:49 -05:00
.2byte \decoration
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Checks if the player has enough space in their PC to hold decoration. Sets variable 0x800D (LASTRESULT) to 0x0001 if there is room, or 0x0000 is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
2018-12-02 19:24:06 +01:00
.macro checkdecorspace decoration:req
2015-10-19 09:42:57 -07:00
.byte 0x4e
2017-10-23 21:18:49 -05:00
.2byte \decoration
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Applies the movement data at movements to the specified (index) Object. Also closes any standard message boxes that are still open.
@ If no map is specified, then the current map is used.
2018-12-02 19:24:06 +01:00
.macro applymovement index:req, movements:req, map
.ifb \map
.byte 0x4f
.2byte \index
.4byte \movements
.else
@ Really only useful if the object has followed from one map to another (e.g. Wally during the catching event).
.byte 0x50
.2byte \index
.4byte \movements
map \map
.endif
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Blocks script execution until the movements being applied to the specified (index) Object finish. If the specified Object is 0x0000, then the command will block script execution until all Objects affected by applymovement finish their movements. If the specified Object is not currently being manipulated with applymovement, then this command does nothing.
@ If no map is specified, then the current map is used.
2018-12-02 19:24:06 +01:00
.macro waitmovement index:req, map
.ifb \map
.byte 0x51
.2byte \index
.else
.byte 0x52
.2byte \index
map \map
.endif
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Attempts to hide the specified (index) Object on the specified (map_group, map_num) map, by setting its visibility flag if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
2018-12-02 19:24:06 +01:00
.macro removeobject index:req, map
.ifb \map
.byte 0x53
.2byte \index
.else
.byte 0x54
.2byte \index
map \map
.endif
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Unsets the specified (index) Object's visibility flag on the specified (map_group, map_num) map if it has a valid one. If the Object does not have a valid visibility flag, this command does nothing.
@ If no map is specified, then the current map is used.
2018-12-02 19:24:06 +01:00
.macro addobject index:req, map
.ifb \map
.byte 0x55
.2byte \index
.else
.byte 0x56
.2byte \index
map \map
.endif
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the specified (index) Object's position on the current map.
2018-12-02 19:24:06 +01:00
.macro setobjectxy index:req, x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0x57
2017-10-23 21:18:49 -05:00
.2byte \index
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro showobjectat index:req, map:req
2015-10-19 09:42:57 -07:00
.byte 0x58
2017-10-23 21:18:49 -05:00
.2byte \index
map \map
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro hideobjectat index:req, map:req
2015-10-19 09:42:57 -07:00
.byte 0x59
2017-10-23 21:18:49 -05:00
.2byte \index
map \map
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ If the script was called by an Object, then that Object will turn to face toward the metatile that the player is standing on.
2018-01-18 12:53:31 -05:00
.macro faceplayer
2015-10-19 09:42:57 -07:00
.byte 0x5a
.endm
2018-12-02 19:24:06 +01:00
.macro turnobject index:req, direction:req
2015-10-19 09:42:57 -07:00
.byte 0x5b
2017-10-23 21:18:49 -05:00
.2byte \index
.byte \direction
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ If the Trainer flag for Trainer index is not set, this command does absolutely nothing.
2018-12-02 15:10:05 -05:00
.macro trainerbattle type:req, trainer:req, local_id:req, pointer1:req, pointer2, pointer3, pointer4
2015-10-19 09:42:57 -07:00
.byte 0x5c
2017-10-23 21:18:49 -05:00
.byte \type
.2byte \trainer
.2byte \local_id
.if \type == TRAINER_BATTLE_SINGLE
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ event script
.elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ event script
.elseif \type == TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.elseif \type == TRAINER_BATTLE_DOUBLE
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
.elseif \type == TRAINER_BATTLE_REMATCH
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
.4byte \pointer4 @ event script
.elseif \type == TRAINER_BATTLE_REMATCH_DOUBLE
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
.elseif \type == TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC
2017-10-23 21:18:49 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.4byte \pointer3 @ text
.4byte \pointer4 @ event script
2018-12-07 23:50:56 +01:00
.elseif \type == TRAINER_BATTLE_PYRAMID
2017-10-27 00:26:34 -05:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_SET_TRAINER_A
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_SET_TRAINER_B
.4byte \pointer1 @ text
.4byte \pointer2 @ text
.elseif \type == TRAINER_BATTLE_12
2017-11-10 18:12:18 -06:00
.4byte \pointer1 @ text
.4byte \pointer2 @ text
2017-10-23 21:18:49 -05:00
.endif
2015-10-19 09:42:57 -07:00
.endm
NO_MUSIC = FALSE
@ Starts a single trainer battle, takes a trainer, intro text, loss text, and an optional event script
@ when used with an event script, you can also pass in an optional flag to disable music
2018-12-02 15:10:05 -05:00
.macro trainerbattle_single trainer:req, intro_text:req, lose_text:req, event_script=FALSE, music=TRUE
.if \event_script == FALSE
trainerbattle TRAINER_BATTLE_SINGLE, \trainer, 0, \intro_text, \lose_text
2018-12-02 15:10:05 -05:00
.elseif \music == TRUE
trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT, \trainer, 0, \intro_text, \lose_text, \event_script
.else
trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \event_script
.endif
.endm
@ Starts a double trainer battle, takes a trainer, intro text, loss text, text for when you have too few pokemon
@ and an optional event script, when used with an event script you can pass in an optional flag to disable music
2018-12-02 15:10:05 -05:00
.macro trainerbattle_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req, event_script=FALSE, music=TRUE
.if \event_script == FALSE
trainerbattle TRAINER_BATTLE_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text
2018-12-02 15:10:05 -05:00
.elseif \music == TRUE
trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script
.else
trainerbattle TRAINER_BATTLE_CONTINUE_SCRIPT_DOUBLE_NO_MUSIC, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text, \event_script
.endif
.endm
@ Starts a rematch battle, takes a trainer, intro text and loss text
2018-12-02 15:10:05 -05:00
.macro trainerbattle_rematch trainer:req, intro_text:req, lose_text:req
trainerbattle TRAINER_BATTLE_REMATCH, \trainer, 0, \intro_text, \lose_text
.endm
@ Starts a rematch double battle, takes a trainer, intro text, loss text, and text for when you have too few pokemon
2018-12-02 15:10:05 -05:00
.macro trainerbattle_rematch_double trainer:req, intro_text:req, lose_text:req, not_enough_pkmn_text:req
trainerbattle TRAINER_BATTLE_REMATCH_DOUBLE, \trainer, 0, \intro_text, \lose_text, \not_enough_pkmn_text
.endm
@ Starts a trainer battle, skipping intro text, takes a trainer and loss text
2018-12-02 15:10:05 -05:00
.macro trainerbattle_no_intro trainer:req, lose_text:req
trainerbattle TRAINER_BATTLE_SINGLE_NO_INTRO_TEXT, \trainer, 0, \lose_text
.endm
2017-10-23 21:18:49 -05:00
2016-09-02 19:51:16 -07:00
@ Starts a trainer battle using the battle information stored in RAM (usually by trainerbattle, which actually calls this command behind-the-scenes), and blocks script execution until the battle finishes.
2018-01-18 12:53:31 -05:00
.macro trainerbattlebegin
2015-10-19 09:42:57 -07:00
.byte 0x5d
.endm
@ Goes to address after the trainerbattle command (called by the battle functions, see battle_setup.c)
2018-01-18 12:53:31 -05:00
.macro gotopostbattlescript
2015-10-19 09:42:57 -07:00
.byte 0x5e
.endm
@ Goes to address specified in the trainerbattle command (called by the battle functions, see battle_setup.c)
2018-01-18 12:53:31 -05:00
.macro gotobeatenscript
2015-10-19 09:42:57 -07:00
.byte 0x5f
.endm
2016-09-02 19:51:16 -07:00
@ Compares Flag (trainer + 0x500) to 1. (If the flag is set, then the trainer has been defeated by the player.)
2018-12-02 19:24:06 +01:00
.macro checktrainerflag trainer:req
2015-10-19 09:42:57 -07:00
.byte 0x60
.2byte \trainer
.endm
2017-10-23 21:18:49 -05:00
@ Sets Flag (trainer + 0x500).
2018-12-02 19:24:06 +01:00
.macro settrainerflag trainer:req
2015-10-19 09:42:57 -07:00
.byte 0x61
.2byte \trainer
.endm
2017-10-23 21:18:49 -05:00
@ Clears Flag (trainer + 0x500).
2018-12-02 19:24:06 +01:00
.macro cleartrainerflag trainer:req
2015-10-19 09:42:57 -07:00
.byte 0x62
.2byte \trainer
.endm
2018-12-02 19:24:06 +01:00
.macro setobjectxyperm index:req, x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0x63
2017-10-23 21:18:49 -05:00
.2byte \index
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro moveobjectoffscreen index:req
2015-10-19 09:42:57 -07:00
.byte 0x64
2017-10-23 21:18:49 -05:00
.2byte \index
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro setobjectmovementtype word:req, byte:req
2015-10-19 09:42:57 -07:00
.byte 0x65
.2byte \word
.byte \byte
.endm
2016-09-02 19:51:16 -07:00
@ If a standard message box (or its text) is being drawn on-screen, this command blocks script execution until the box and its text have been fully drawn.
2018-01-18 12:53:31 -05:00
.macro waitmessage
2015-10-19 09:42:57 -07:00
.byte 0x66
.endm
2016-09-02 19:51:16 -07:00
@ Starts displaying a standard message box containing the specified text. If text is a pointer, then the string at that offset will be loaded and used. If text is script bank 0, then the value of script bank 0 will be treated as a pointer to the text. (You can use loadpointer to place a string pointer in a script bank.)
2018-12-02 19:24:06 +01:00
.macro message text:req
2015-10-19 09:42:57 -07:00
.byte 0x67
.4byte \text
.endm
2017-10-23 21:18:49 -05:00
@ Closes the current message box.
2018-01-18 12:53:31 -05:00
.macro closemessage
2015-10-19 09:42:57 -07:00
.byte 0x68
.endm
2017-10-23 21:18:49 -05:00
@ Ceases movement for all Objects on-screen.
2018-01-18 12:53:31 -05:00
.macro lockall
2015-10-19 09:42:57 -07:00
.byte 0x69
.endm
2017-10-23 21:18:49 -05:00
@ If the script was called by an Object, then that Object's movement will cease.
2018-01-18 12:53:31 -05:00
.macro lock
2015-10-19 09:42:57 -07:00
.byte 0x6a
.endm
2017-10-23 21:18:49 -05:00
@ Resumes normal movement for all Objects on-screen, and closes any standard message boxes that are still open.
2018-01-18 12:53:31 -05:00
.macro releaseall
2015-10-19 09:42:57 -07:00
.byte 0x6b
.endm
2017-10-23 21:18:49 -05:00
@ If the script was called by an Object, then that Object's movement will resume. This command also closes any standard message boxes that are still open.
2018-01-18 12:53:31 -05:00
.macro release
2015-10-19 09:42:57 -07:00
.byte 0x6c
.endm
2016-09-02 19:51:16 -07:00
@ Blocks script execution until the player presses any key.
2018-01-18 12:53:31 -05:00
.macro waitbuttonpress
2015-10-19 09:42:57 -07:00
.byte 0x6d
.endm
2016-09-02 19:51:16 -07:00
@ Displays a YES/NO multichoice box at the specified coordinates, and blocks script execution until the user makes a selection. Their selection is stored in variable 0x800D (LASTRESULT); 0x0000 for "NO" or if the user pressed B, and 0x0001 for "YES".
2018-12-02 19:24:06 +01:00
.macro yesnobox x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0x6e
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
2018-12-02 19:24:06 +01:00
.macro multichoice x:req, y:req, list:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x6f
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.byte \list
2017-10-23 21:18:49 -05:00
.byte \b
2015-10-19 09:42:57 -07:00
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. The default argument determines the initial position of the cursor when the box is first opened; it is zero-indexed, and if it is too large, it is treated as 0x00. If b is set to a non-zero value, then the user will not be allowed to back out of the multichoice with the B button.
2018-12-02 19:24:06 +01:00
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req
2015-10-19 09:42:57 -07:00
.byte 0x70
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.byte \list
.byte \default
2017-10-23 21:18:49 -05:00
.byte \b
2015-10-19 09:42:57 -07:00
.endm
@ Displays a multichoice box from which the user can choose a selection, and blocks script execution until a selection is made. Lists of options are predefined (gMultichoiceLists) and the one to be used is specified with list. The per_row argument determines how many list items will be shown on a single row of the box.
2018-12-02 19:24:06 +01:00
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
2015-10-19 09:42:57 -07:00
.byte 0x71
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.byte \list
.byte \per_row
.byte \B
.endm
2017-10-23 21:18:49 -05:00
@ Nopped in Emerald.
2018-01-18 12:53:31 -05:00
.macro drawbox
2015-10-19 09:42:57 -07:00
.byte 0x72
.endm
2017-10-23 21:18:49 -05:00
@ Nopped in Emerald, but still consumes parameters.
2018-12-02 19:24:06 +01:00
.macro erasebox byte1:req, byte2:req, byte3:req, byte4:req
2015-10-19 09:42:57 -07:00
.byte 0x73
.byte \byte1
.byte \byte2
.byte \byte3
.byte \byte4
.endm
2017-10-23 21:18:49 -05:00
@ Nopped in Emerald, but still consumes parameters.
2018-12-02 19:24:06 +01:00
.macro drawboxtext byte1:req, byte2:req, byte3:req, byte4:req
2015-10-19 09:42:57 -07:00
.byte 0x74
.byte \byte1
.byte \byte2
.byte \byte3
.byte \byte4
.endm
2017-10-23 21:18:49 -05:00
@ Displays a box containing the front sprite for the specified (species) Pokemon species.
2018-12-02 19:24:06 +01:00
.macro drawmonpic species:req, x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0x75
.2byte \species
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Hides all boxes displayed with drawmonpic.
2018-01-18 12:53:31 -05:00
.macro erasemonpic
2015-10-19 09:42:57 -07:00
.byte 0x76
.endm
2017-10-23 21:18:49 -05:00
@ Draws an image of the winner of the contest. In FireRed, this command is a nop. (The argument is discarded.)
2018-12-02 19:24:06 +01:00
.macro drawcontestwinner a:req
2015-10-19 09:42:57 -07:00
.byte 0x77
.byte \a
.endm
2017-10-23 21:18:49 -05:00
@ Displays the string at pointer as braille text in a standard message box. The string must be formatted to use braille characters and needs to provide six extra starting characters that are skipped (in RS, these characters determined the box's size and position, but in Emerald these are calculated automatically).
2018-12-02 19:24:06 +01:00
.macro braillemessage text:req
2015-10-19 09:42:57 -07:00
.byte 0x78
.4byte \text
.endm
2017-10-23 21:18:49 -05:00
@ Gives the player one of the specified (species) Pokemon at level level holding item. The unknown arguments should all be zeroes.
2018-12-02 19:24:06 +01:00
.macro givemon species:req, level:req, item:req, unknown1:req, unknown2:req, unknown3:req
2015-10-19 09:42:57 -07:00
.byte 0x79
.2byte \species
.byte \level
.2byte \item
.4byte \unknown1
.4byte \unknown2
.byte \unknown3
.endm
2018-12-02 19:24:06 +01:00
.macro giveegg species:req
2015-10-19 09:42:57 -07:00
.byte 0x7a
2017-10-23 21:18:49 -05:00
.2byte \species
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro setmonmove index:req, slot:req, move:req
2015-10-19 09:42:57 -07:00
.byte 0x7b
.byte \index
.byte \slot
.2byte \move
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, variable 0x800D (LASTRESULT) is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, LASTRESULT is set to 0x0006. Variable 0x8004 is also set to this Pokemon's species.
2018-12-02 19:24:06 +01:00
.macro checkpartymove index:req
2015-10-19 09:42:57 -07:00
.byte 0x7c
.2byte \index
.endm
2017-10-23 21:18:49 -05:00
@ Writes the name of the Pokemon at index species to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro bufferspeciesname out:req, species:req
2015-10-19 09:42:57 -07:00
.byte 0x7d
.byte \out
.2byte \species
.endm
2017-10-23 21:18:49 -05:00
@ Writes the name of the species of the first Pokemon in the player's party to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro bufferleadmonspeciesname out:req
2015-10-19 09:42:57 -07:00
.byte 0x7e
.byte \out
.endm
2017-10-23 21:18:49 -05:00
@ Writes the nickname of the Pokemon in slot slot (zero-indexed) of the player's party to the specified buffer. If an empty or invalid slot is specified, ten spaces ("") are written to the buffer.
2018-12-02 19:24:06 +01:00
.macro bufferpartymonnick out:req, slot:req
2015-10-19 09:42:57 -07:00
.byte 0x7f
.byte \out
.2byte \slot
.endm
2016-09-02 19:51:16 -07:00
@ Writes the name of the item at index item to the specified buffer. If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
2018-12-02 19:24:06 +01:00
.macro bufferitemname out:req, item:req
2015-10-19 09:42:57 -07:00
.byte 0x80
.byte \out
.2byte \item
.endm
2017-10-23 21:18:49 -05:00
@ Writes the name of the decoration at index decoration to the specified buffer. In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro bufferdecorationname out:req, decoration:req
2015-10-19 09:42:57 -07:00
.byte 0x81
2017-10-23 21:18:49 -05:00
.byte \out
.2byte \decoration
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Writes the name of the move at index move to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro buffermovename out:req, move:req
2015-10-19 09:42:57 -07:00
.byte 0x82
.byte \out
2017-10-23 21:18:49 -05:00
.2byte \move
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Converts the value of input to a decimal string, and writes that string to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro buffernumberstring out:req, input:req
2015-10-19 09:42:57 -07:00
.byte 0x83
.byte \out
.2byte \input
.endm
2017-10-23 21:18:49 -05:00
@ Writes the standard string identified by index to the specified buffer. This command has no protections in place at all, so specifying an invalid standard string (e.x. 0x2B) can and usually will cause data corruption.
2018-12-02 19:24:06 +01:00
.macro bufferstdstring out:req, index:req
2015-10-19 09:42:57 -07:00
.byte 0x84
.byte \out
.2byte \index
.endm
2016-09-02 19:51:16 -07:00
@ Copies the string at offset to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro bufferstring out:req, offset:req
2015-10-19 09:42:57 -07:00
.byte 0x85
.byte \out
.4byte \offset
.endm
2016-09-02 19:51:16 -07:00
@ Opens the Pokemart system, offering the specified products for sale.
2018-12-02 19:24:06 +01:00
.macro pokemart products:req
2015-10-19 09:42:57 -07:00
.byte 0x86
.4byte \products
.endm
2017-10-23 21:18:49 -05:00
@ Opens the Pokemart system and treats the list of items as decorations.
2018-12-02 19:24:06 +01:00
.macro pokemartdecoration products:req
2015-10-19 09:42:57 -07:00
.byte 0x87
.4byte \products
.endm
2017-10-23 21:18:49 -05:00
@ Apparent clone of pokemartdecoration.
2018-12-02 19:24:06 +01:00
.macro pokemartdecoration2 products:req
2015-10-19 09:42:57 -07:00
.byte 0x88
.4byte \products
.endm
2017-10-23 21:18:49 -05:00
@ Starts up the slot machine minigame.
2018-12-02 19:24:06 +01:00
.macro playslotmachine word:req
2015-10-19 09:42:57 -07:00
.byte 0x89
.2byte \word
.endm
2017-10-23 21:18:49 -05:00
@ Sets a berry tree's specific berry and growth stage. In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro setberrytree tree_id:req, berry:req, growth_stage:req
2015-10-19 09:42:57 -07:00
.byte 0x8a
2017-10-23 21:18:49 -05:00
.byte \tree_id
.byte \berry
.byte \growth_stage
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ This allows you to choose a Pokemon to use in a contest. In FireRed, this command sets the byte at 0x03000EA8 to 0x01.
2018-01-18 12:53:31 -05:00
.macro choosecontestmon
2015-10-19 09:42:57 -07:00
.byte 0x8b
.endm
2017-10-23 21:18:49 -05:00
@ Starts a contest. In FireRed, this command is a nop.
2018-01-18 12:53:31 -05:00
.macro startcontest
2015-10-19 09:42:57 -07:00
.byte 0x8c
.endm
2017-10-23 21:18:49 -05:00
@ Shows the results of a contest. In FireRed, this command is a nop.
2018-01-18 12:53:31 -05:00
.macro showcontestresults
2015-10-19 09:42:57 -07:00
.byte 0x8d
.endm
2017-10-23 21:18:49 -05:00
@ Starts a contest over a link connection. In FireRed, this command is a nop.
2018-01-18 12:53:31 -05:00
.macro contestlinktransfer
2015-10-19 09:42:57 -07:00
.byte 0x8e
.endm
2016-09-02 19:51:16 -07:00
@ Stores a random integer between 0 and limit in variable 0x800D (LASTRESULT).
2018-12-02 19:24:06 +01:00
.macro random limit:req
2015-10-19 09:42:57 -07:00
.byte 0x8f
.2byte \limit
.endm
2016-09-02 19:51:16 -07:00
@ If check is 0x00, this command adds value to the player's money.
2018-12-02 19:24:06 +01:00
.macro givemoney value:req, check:req
2015-10-19 09:42:57 -07:00
.byte 0x90
.4byte \value
.byte \check
.endm
2016-09-02 19:51:16 -07:00
@ If check is 0x00, this command subtracts value from the player's money.
2018-12-02 19:24:06 +01:00
.macro takemoney value:req, check:req
2015-10-19 09:42:57 -07:00
.byte 0x91
.4byte \value
.byte \check
.endm
2016-09-02 19:51:16 -07:00
@ If check is 0x00, this command will check if the player has value or more money; script variable 0x800D (LASTRESULT) is set to 0x0001 if the player has enough money, or 0x0000 if the do not.
2018-12-02 19:24:06 +01:00
.macro checkmoney value:req, check:req
2015-10-19 09:42:57 -07:00
.byte 0x92
.4byte \value
.byte \check
.endm
2016-09-02 19:51:16 -07:00
@ Spawns a secondary box showing how much money the player has.
2018-12-02 19:24:06 +01:00
.macro showmoneybox x:req, y:req, check:req
2015-10-19 09:42:57 -07:00
.byte 0x93
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
.byte \check
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Hides the secondary box spawned by showmoney.
2018-01-18 12:53:31 -05:00
.macro hidemoneybox
2015-10-19 09:42:57 -07:00
.byte 0x94
.endm
2017-10-23 21:18:49 -05:00
@ Updates the secondary box spawned by showmoney. Consumes but does not use arguments.
2018-12-02 19:24:06 +01:00
.macro updatemoneybox x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0x95
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
@ Gets the price reduction for the index given. In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro getpricereduction index:req
2015-10-19 09:42:57 -07:00
.byte 0x96
.2byte \index
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white.
2018-12-02 19:24:06 +01:00
.macro fadescreen effect:req
2015-10-19 09:42:57 -07:00
.byte 0x97
.byte \effect
.endm
2017-10-23 21:18:49 -05:00
@ Fades the screen to and from black and white. Mode 0x00 fades from black, mode 0x01 fades out to black, mode 0x2 fades in from white, and mode 0x3 fades out to white. Other modes may exist.
2018-12-02 19:24:06 +01:00
.macro fadescreenspeed effect:req, speed:req
2015-10-19 09:42:57 -07:00
.byte 0x98
2017-10-23 21:18:49 -05:00
.byte \effect
.byte \speed
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro setflashradius word:req
2015-10-19 09:42:57 -07:00
.byte 0x99
.2byte \word
.endm
2018-12-02 19:24:06 +01:00
.macro animateflash byte:req
2015-10-19 09:42:57 -07:00
.byte 0x9a
.byte \byte
.endm
2018-12-02 19:24:06 +01:00
.macro messageautoscroll pointer:req
2015-10-19 09:42:57 -07:00
.byte 0x9b
.4byte \pointer
.endm
2016-09-02 19:51:16 -07:00
@ Executes the specified field move animation.
2018-12-02 19:24:06 +01:00
.macro dofieldeffect animation:req
2015-10-19 09:42:57 -07:00
.byte 0x9c
.2byte \animation
.endm
2017-10-23 21:18:49 -05:00
@ Sets up the field effect argument argument with the value value.
2018-12-02 19:24:06 +01:00
.macro setfieldeffectargument argument:req, param:req
2015-10-19 09:42:57 -07:00
.byte 0x9d
2017-10-23 21:18:49 -05:00
.byte \argument
.2byte \param
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Blocks script execution until all playing field move animations complete.
2018-12-02 19:24:06 +01:00
.macro waitfieldeffect animation:req
2015-10-19 09:42:57 -07:00
.byte 0x9e
.2byte \animation
.endm
2017-10-23 21:18:49 -05:00
@ Sets which healing place the player will return to if all of the Pokemon in their party faint.
2018-12-02 19:24:06 +01:00
.macro setrespawn heallocation:req
2015-10-19 09:42:57 -07:00
.byte 0x9f
.2byte \heallocation
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Checks the player's gender. If male, then 0x0000 is stored in variable 0x800D (LASTRESULT). If female, then 0x0001 is stored in LASTRESULT.
2018-01-18 12:53:31 -05:00
.macro checkplayergender
2015-10-19 09:42:57 -07:00
.byte 0xa0
.endm
2017-10-23 21:18:49 -05:00
@ Plays the specified (species) Pokemon's cry. You can use waitcry to block script execution until the sound finishes.
2018-12-02 19:24:06 +01:00
.macro playmoncry species:req, effect:req
2015-10-19 09:42:57 -07:00
.byte 0xa1
.2byte \species
.2byte \effect
.endm
2017-10-23 21:18:49 -05:00
@ Changes the metatile at (x, y) on the current map.
2019-02-26 22:56:22 -05:00
.macro setmetatile x:req, y:req, metatile_number:req, has_collision:req
2015-10-19 09:42:57 -07:00
.byte 0xa2
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
.2byte \metatile_number
2019-02-26 22:56:22 -05:00
.2byte \has_collision
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Queues a weather change to the default weather for the map.
2018-01-18 12:53:31 -05:00
.macro resetweather
2015-10-19 09:42:57 -07:00
.byte 0xa3
.endm
2016-09-02 19:51:16 -07:00
@ Queues a weather change to type weather.
2018-12-02 19:24:06 +01:00
.macro setweather type:req
2015-10-19 09:42:57 -07:00
.byte 0xa4
.2byte \type
.endm
2016-09-02 19:51:16 -07:00
@ Executes the weather change queued with resetweather or setweather. The current weather will smoothly fade into the queued weather.
2018-01-18 12:53:31 -05:00
.macro doweather
2015-10-19 09:42:57 -07:00
.byte 0xa5
.endm
2016-09-02 19:51:16 -07:00
@ This command manages cases in which maps have tiles that change state when stepped on (specifically, cracked/breakable floors).
2018-12-02 19:24:06 +01:00
.macro setstepcallback subroutine:req
2015-10-19 09:42:57 -07:00
.byte 0xa6
.byte \subroutine
.endm
2018-12-02 19:24:06 +01:00
.macro setmaplayoutindex index:req
2015-10-19 09:42:57 -07:00
.byte 0xa7
2017-10-23 21:18:49 -05:00
.2byte \index
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro setobjectpriority index:req, map:req, priority:req
2015-10-19 09:42:57 -07:00
.byte 0xa8
2017-10-23 21:18:49 -05:00
.2byte \index
map \map
.byte \priority
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro resetobjectpriority index:req, map:req
2015-10-19 09:42:57 -07:00
.byte 0xa9
2017-10-23 21:18:49 -05:00
.2byte \index
map \map
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro createvobject sprite:req, byte2:req, x:req, y:req, elevation, direction
2015-10-19 09:42:57 -07:00
.byte 0xaa
2017-10-23 21:18:49 -05:00
.byte \sprite
2015-10-19 09:42:57 -07:00
.byte \byte2
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
.byte \elevation
.byte \direction
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro turnvobject index:req, direction:req
2015-10-19 09:42:57 -07:00
.byte 0xab
2017-10-23 21:18:49 -05:00
.byte \index
.byte \direction
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Opens the door metatile at (X, Y) with an animation.
2018-12-02 19:24:06 +01:00
.macro opendoor x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xac
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Closes the door metatile at (X, Y) with an animation.
2018-12-02 19:24:06 +01:00
.macro closedoor x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xad
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Waits for the door animation started with opendoor or closedoor to finish.
2018-01-18 12:53:31 -05:00
.macro waitdooranim
2015-10-19 09:42:57 -07:00
.byte 0xae
.endm
2017-10-23 21:18:49 -05:00
@ Sets the door tile at (x, y) to be open without an animation.
2018-12-02 19:24:06 +01:00
.macro setdooropen x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xaf
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the door tile at (x, y) to be closed without an animation.
2018-12-02 19:24:06 +01:00
.macro setdoorclosed x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xb0
2017-10-23 21:18:49 -05:00
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ In Emerald, this command consumes its parameters and does nothing. In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro addelevmenuitem a:req, b:req, c:req, d:req
2015-10-19 09:42:57 -07:00
.byte 0xb1
2017-10-23 21:18:49 -05:00
.byte \a
.2byte \b
.2byte \c
.2byte \d
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ In FireRed and Emerald, this command is a nop.
2018-01-18 12:53:31 -05:00
.macro showelevmenu
2015-10-19 09:42:57 -07:00
.byte 0xb2
.endm
2018-12-02 19:24:06 +01:00
.macro checkcoins out:req
2015-10-19 09:42:57 -07:00
.byte 0xb3
2017-10-23 21:18:49 -05:00
.2byte \out
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro givecoins count:req
2015-10-19 09:42:57 -07:00
.byte 0xb4
2017-10-23 21:18:49 -05:00
.2byte \count
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro takecoins count:req
2015-10-19 09:42:57 -07:00
.byte 0xb5
.2byte \count
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Prepares to start a wild battle against a species at Level level holding item. Running this command will not affect normal wild battles. You start the prepared battle with dowildbattle.
2018-12-02 19:24:06 +01:00
.macro setwildbattle species:req, level:req, item:req
2015-10-19 09:42:57 -07:00
.byte 0xb6
.2byte \species
.byte \level
.2byte \item
.endm
2017-10-23 21:18:49 -05:00
@ Starts a wild battle against the Pokemon generated by setwildbattle. Blocks script execution until the battle finishes.
2018-01-18 12:53:31 -05:00
.macro dowildbattle
2015-10-19 09:42:57 -07:00
.byte 0xb7
.endm
2018-12-02 19:24:06 +01:00
.macro setvaddress pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xb8
2017-12-21 16:06:12 -06:00
.4byte \pointer
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro vgoto pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xb9
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vcall pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xba
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vgoto_if byte:req, pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xbb
.byte \byte
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vcall_if byte:req, pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xbc
.byte \byte
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vmessage pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xbd
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vloadptr pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xbe
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro vbufferstring byte:req, pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xbf
.byte \byte
.4byte \pointer
.endm
2016-09-02 19:51:16 -07:00
@ Spawns a secondary box showing how many Coins the player has.
2018-12-02 19:24:06 +01:00
.macro showcoinsbox x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xc0
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Hides the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
2018-12-02 19:24:06 +01:00
.macro hidecoinsbox x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xc1
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Updates the secondary box spawned by showcoins. It consumes its arguments but doesn't use them.
2018-12-02 19:24:06 +01:00
.macro updatecoinsbox x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xc2
2017-10-23 21:18:49 -05:00
.byte \x
.byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Increases the value of the specified game stat by 1. The stat's value will not be allowed to exceed 0x00FFFFFF.
2018-12-02 19:24:06 +01:00
.macro incrementgamestat stat:req
2015-10-19 09:42:57 -07:00
.byte 0xc3
2017-10-23 21:18:49 -05:00
.byte \stat
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Sets the destination that using an Escape Rope or Dig will take the player to.
2018-12-02 19:24:06 +01:00
.macro setescapewarp map:req, warp:req, x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xc4
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2016-09-02 19:51:16 -07:00
@ Blocks script execution until cry finishes.
2018-01-18 12:53:31 -05:00
.macro waitmoncry
2015-10-19 09:42:57 -07:00
.byte 0xc5
.endm
2016-09-02 19:51:16 -07:00
@ Writes the name of the specified (box) PC box to the specified buffer.
2018-12-02 19:24:06 +01:00
.macro bufferboxname out:req, box:req
2015-10-19 09:42:57 -07:00
.byte 0xc6
.byte \out
.2byte \box
.endm
2016-09-02 19:51:16 -07:00
@ Sets the color of the text in standard message boxes. 0x00 produces blue (male) text, 0x01 produces red (female) text, 0xFF resets the color to the default for the current OW's gender, and all other values produce black text.
2018-12-02 19:24:06 +01:00
.macro textcolor color:req
2015-10-19 09:42:57 -07:00
.byte 0xc7
.byte \color
.endm
2016-09-02 19:51:16 -07:00
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
2018-12-02 19:24:06 +01:00
.macro loadhelp pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xc8
.4byte \pointer
.endm
2016-09-02 19:51:16 -07:00
@ The exact purpose of this command is unknown, but it is related to the blue help-text box that appears on the bottom of the screen when the Main Menu is opened.
2018-01-18 12:53:31 -05:00
.macro unloadhelp
2015-10-19 09:42:57 -07:00
.byte 0xc9
.endm
2016-09-02 19:51:16 -07:00
@ After using this command, all standard message boxes will use the signpost frame.
2018-01-18 12:53:31 -05:00
.macro signmsg
2015-10-19 09:42:57 -07:00
.byte 0xca
.endm
2016-09-02 19:51:16 -07:00
@ Ends the effects of signmsg, returning message box frames to normal.
2018-01-18 12:53:31 -05:00
.macro normalmsg
2015-10-19 09:42:57 -07:00
.byte 0xcb
.endm
2016-09-02 19:51:16 -07:00
@ Compares the value of a hidden variable to a dword.
2018-12-02 19:24:06 +01:00
.macro comparehiddenvar a:req, value:req
2015-10-19 09:42:57 -07:00
.byte 0xcc
.byte \a
.4byte \value
.endm
2017-10-23 21:18:49 -05:00
@ Makes the Pokemon in the specified slot of the player's party obedient. It will not randomly disobey orders in battle.
2018-12-02 19:24:06 +01:00
.macro setmonobedient slot:req
2015-10-19 09:42:57 -07:00
.byte 0xcd
.2byte \slot
.endm
2017-10-23 21:18:49 -05:00
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, 0x0001 is written to script variable 0x800D (LASTRESULT). If the Pokemon is obedient (or if the specified slot is empty or invalid), 0x0000 is written.
2018-12-02 19:24:06 +01:00
.macro checkmonobedience slot:req
2015-10-19 09:42:57 -07:00
.byte 0xce
.2byte \slot
.endm
2017-10-23 21:18:49 -05:00
@ Depending on factors I haven't managed to understand yet, this command may cause script execution to jump to the offset specified by the pointer at 0x020375C0.
.macro gotoram
2015-10-19 09:42:57 -07:00
.byte 0xcf
.endm
2016-09-02 19:51:16 -07:00
@ Sets worldmapflag to 1. This allows the player to Fly to the corresponding map, if that map has a flightspot.
2018-12-02 19:24:06 +01:00
.macro setworldmapflag worldmapflag:req
2015-10-19 09:42:57 -07:00
.byte 0xd0
.2byte \worldmapflag
.endm
2016-09-02 19:51:16 -07:00
@ Clone of warpteleport? It is apparently only used in FR/LG, and only with specials.[source]
2018-12-02 19:24:06 +01:00
.macro warpteleport2 map:req, warp:req, x:req, y:req
2015-10-19 09:42:57 -07:00
.byte 0xd1
2017-10-23 21:18:49 -05:00
map \map
.byte \warp
.2byte \x
.2byte \y
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 21:18:49 -05:00
@ Changes the location where the player caught the Pokemon in the specified slot of their party.
2018-12-02 19:24:06 +01:00
.macro setmonmetlocation slot:req, location:req
2015-10-19 09:42:57 -07:00
.byte 0xd2
.2byte \slot
.byte \location
.endm
2018-12-02 19:24:06 +01:00
.macro mossdeepgym1 unknown:req
2015-10-19 09:42:57 -07:00
.byte 0xd3
2017-10-23 21:18:49 -05:00
.2byte \unknown
2015-10-19 09:42:57 -07:00
.endm
2018-01-18 12:53:31 -05:00
.macro mossdeepgym2
2015-10-19 09:42:57 -07:00
.byte 0xd4
.endm
2016-09-02 19:51:16 -07:00
@ In FireRed, this command is a nop.
2018-12-02 19:24:06 +01:00
.macro mossdeepgym3 var:req
2015-10-19 09:42:57 -07:00
.byte 0xd5
2017-10-23 21:18:49 -05:00
.2byte \var
2015-10-19 09:42:57 -07:00
.endm
2018-01-18 12:53:31 -05:00
.macro mossdeepgym4
2015-10-19 09:42:57 -07:00
.byte 0xd6
.endm
2018-12-02 19:24:06 +01:00
.macro warp7 map:req, byte:req, word1:req, word2:req
2015-10-19 09:42:57 -07:00
.byte 0xd7
2017-10-23 21:18:49 -05:00
map \map
.byte \byte
2015-10-19 09:42:57 -07:00
.2byte \word1
.2byte \word2
.endm
2018-01-18 12:53:31 -05:00
.macro cmdD8
2015-10-19 09:42:57 -07:00
.byte 0xd8
.endm
2018-01-18 12:53:31 -05:00
.macro cmdD9
2015-10-19 09:42:57 -07:00
.byte 0xd9
.endm
2018-01-18 12:53:31 -05:00
.macro hidebox2
2015-10-19 09:42:57 -07:00
.byte 0xda
.endm
2018-12-02 19:24:06 +01:00
.macro message3 pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xdb
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro fadescreenswapbuffers byte:req
2015-10-19 09:42:57 -07:00
.byte 0xdc
.byte \byte
.endm
2018-12-02 19:24:06 +01:00
.macro buffertrainerclassname out:req, class:req
2015-10-19 09:42:57 -07:00
.byte 0xdd
2017-10-23 21:18:49 -05:00
.byte \out
.2byte \class
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro buffertrainername out:req, trainer:req
2015-10-19 09:42:57 -07:00
.byte 0xde
2017-10-23 21:18:49 -05:00
.byte \out
.2byte \trainer
2015-10-19 09:42:57 -07:00
.endm
2018-12-02 19:24:06 +01:00
.macro pokenavcall pointer:req
2015-10-19 09:42:57 -07:00
.byte 0xdf
.4byte \pointer
.endm
2018-12-02 19:24:06 +01:00
.macro warp8 map:req, byte:req, word1:req, word2:req
2015-10-19 09:42:57 -07:00
.byte 0xe0
2017-10-23 21:18:49 -05:00
map \map
.byte \byte
2015-10-19 09:42:57 -07:00
.2byte \word1
.2byte \word2
.endm
2018-12-02 19:24:06 +01:00
.macro buffercontesttypestring out:req, word:req
2015-10-19 09:42:57 -07:00
.byte 0xe1
2017-10-23 21:18:49 -05:00
.byte \out
2015-10-19 09:42:57 -07:00
.2byte \word
.endm
2017-10-23 21:18:49 -05:00
@ Writes the name of the specified (item) item to the specified buffer. If the specified item is a Berry (0x85 - 0xAE) or Poke Ball (0x4) and if the quantity is 2 or more, the buffered string will be pluralized ("IES" or "S" appended). If the specified item is the Enigma Berry, I have no idea what this command does (but testing showed no pluralization). If the specified index is larger than the number of items in the game (0x176), the name of item 0 ("????????") is buffered instead.
2018-12-02 19:24:06 +01:00
.macro bufferitemnameplural out:req, item:req, quantity:req
2015-10-19 09:42:57 -07:00
.byte 0xe2
2017-10-23 21:18:49 -05:00
.byte \out
.2byte \item
.2byte \quantity
.endm
@ Supplementary
2018-12-21 21:32:45 -05:00
.macro goto_if_unset flag:req, dest:req
2018-12-21 20:28:24 -05:00
checkflag \flag
goto_if 0, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_set flag:req, dest:req
2018-12-21 20:28:24 -05:00
checkflag \flag
2017-10-23 21:18:49 -05:00
goto_if 1, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_lt dest:req @ LESS THAN
2018-12-21 20:28:24 -05:00
goto_if 0, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_eq dest:req @ EQUAL
2018-12-21 20:28:24 -05:00
goto_if 1, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_gt dest:req @ GREATER THAN
2018-12-21 20:28:24 -05:00
goto_if 2, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_le dest:req @ LESS THAN OR EQUAL
2018-12-21 20:28:24 -05:00
goto_if 3, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_ge dest:req @ GREATER THAN OR EQUAL
2018-12-21 20:28:24 -05:00
goto_if 4, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro goto_if_ne dest:req @ NOT EQUAL
2018-12-21 20:28:24 -05:00
goto_if 5, \dest
.endm
2018-12-21 21:32:45 -05:00
.macro call_if_unset flag:req, dest:req
checkflag \flag
call_if 0, \dest
.endm
.macro call_if_set flag:req, dest:req
checkflag \flag
call_if 1, \dest
.endm
.macro call_if_lt dest:req @ LESS THAN
call_if 0, \dest
.endm
.macro call_if_eq dest:req @ EQUAL
call_if 1, \dest
.endm
.macro call_if_gt dest:req @ GREATER THAN
call_if 2, \dest
.endm
.macro call_if_le dest:req @ LESS THAN OR EQUAL
call_if 3, \dest
.endm
.macro call_if_ge dest:req @ GREATER THAN OR EQUAL
call_if 4, \dest
.endm
.macro call_if_ne dest:req @ NOT EQUAL
call_if 5, \dest
.endm
2018-12-02 19:24:06 +01:00
.macro switch var:req
copyvar VAR_0x8000, \var
2017-10-23 21:18:49 -05:00
.endm
2018-12-02 19:24:06 +01:00
.macro case condition:req, dest:req
compare VAR_0x8000, \condition
2018-12-21 20:28:24 -05:00
goto_if_eq \dest
2015-10-19 09:42:57 -07:00
.endm
2017-10-23 22:18:35 -05:00
2017-10-26 18:03:19 -05:00
@ Message box types
MSGBOX_NPC = 2
MSGBOX_SIGN = 3
MSGBOX_DEFAULT = 4
2017-10-26 18:03:19 -05:00
MSGBOX_YESNO = 5
MSGBOX_AUTOCLOSE = 6
2017-10-26 18:03:19 -05:00
YES = 1
NO = 0
2018-12-02 19:38:05 +01:00
.macro msgbox text:req, type=MSGBOX_DEFAULT
loadword 0, \text
callstd \type
.endm
2018-12-02 19:24:06 +01:00
.macro giveitem_std item:req, amount=1, function=0
setorcopyvar VAR_0x8000, \item
setorcopyvar VAR_0x8001, \amount
2017-10-23 22:18:35 -05:00
callstd \function
.endm
2017-10-24 00:11:26 -05:00
2018-12-02 19:24:06 +01:00
.macro givedecoration_std decoration:req
setorcopyvar VAR_0x8000, \decoration
callstd STD_OBTAIN_DECORATION
2017-10-24 00:11:26 -05:00
.endm
2018-12-02 06:04:59 -05:00
2018-12-02 19:38:05 +01:00
.macro register_matchcall trainer:req
2018-12-02 06:04:59 -05:00
setvar VAR_0x8004, \trainer
special SetMatchCallRegisteredFlag
setorcopyvar VAR_0x8000, \trainer
callstd STD_REGISTER_MATCH_CALL
2017-10-24 00:11:26 -05:00
.endm