Made documentation more readable

This change will make the script command documentation more user-friendly to read.
Additionally, provided the information on the 'delay' macro. I have confirmed that this
is indeed Frames and not Milliseconds. Updated the macro respectively.
This commit is contained in:
Ryuhouji 2020-07-09 15:16:37 -04:00 committed by GitHub
parent ebade7affb
commit d261374044
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -274,15 +274,17 @@
.2byte \functionId .2byte \functionId
.endm .endm
@ 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). @ 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).
.macro waitstate .macro waitstate
.byte 0x27 .byte 0x27
.endm .endm
@ Blocks script execution for time (frames? milliseconds?). @ Blocks script execution for frames. (Pokemon Emerald runs at just shy of 60 frames per second.)
.macro delay time:req .macro delay frames:req
.byte 0x28 .byte 0x28
.2byte \time .2byte \frames
.endm .endm
@ Sets a to 1. @ Sets a to 1.
@ -315,7 +317,8 @@
.byte 0x2d .byte 0x2d
.endm .endm
@ 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. @ 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.
.macro gettime .macro gettime
.byte 0x2e .byte 0x2e
.endm .endm
@ -378,7 +381,8 @@
.byte \speed .byte \speed
.endm .endm
@ 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. @ 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.
.macro warp map:req, warp:req, X:req, Y:req .macro warp map:req, warp:req, X:req, Y:req
.byte 0x39 .byte 0x39
map \map map \map
@ -429,7 +433,8 @@
.2byte \Y .2byte \Y
.endm .endm
@ 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). @ 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).
.macro setdynamicwarp map:req, warp:req, X:req, Y:req .macro setdynamicwarp map:req, warp:req, X:req, Y:req
.byte 0x3f .byte 0x3f
map \map map \map
@ -468,7 +473,8 @@
.byte 0x43 .byte 0x43
.endm .endm
@ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE. @ Attempts to add quantity of item index to the player's Bag. If the player has enough room, the item will be added and
@ VAR_RESULT will be set to TRUE; otherwise, VAR_RESULT is set to FALSE.
.macro additem index:req, quantity=1 .macro additem index:req, quantity=1
.byte 0x44 .byte 0x44
.2byte \index .2byte \index
@ -482,21 +488,24 @@
.2byte \quantity .2byte \quantity
.endm .endm
@ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. @ Checks if the player has enough space in their Bag to hold quantity more of item index. Sets VAR_RESULT to
@ TRUE if there is room, or FALSE is there is no room.
.macro checkitemspace index:req, quantity:req .macro checkitemspace index:req, quantity:req
.byte 0x46 .byte 0x46
.2byte \index .2byte \index
.2byte \quantity .2byte \quantity
.endm .endm
@ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has enough of the item, or FALSE if they have fewer than quantity of the item. @ Checks if the player has quantity or more of item index in their Bag. Sets VAR_RESULT to TRUE if the player has
@ enough of the item, or FALSE if they have fewer than quantity of the item.
.macro checkitem index:req, quantity:req .macro checkitem index:req, quantity:req
.byte 0x47 .byte 0x47
.2byte \index .2byte \index
.2byte \quantity .2byte \quantity
.endm .endm
@ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT. 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). @ Checks which Bag pocket the specified item belongs in, and writes the pocket value (POCKET_*) to VAR_RESULT.
@ 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).
.macro checkitemtype index:req .macro checkitemtype index:req
.byte 0x48 .byte 0x48
.2byte \index .2byte \index
@ -534,7 +543,8 @@
.2byte \decoration .2byte \decoration
.endm .endm
@ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.) @ Checks if the player has enough space in their PC to hold decoration. Sets VAR_RESULT to TRUE if there is room, or
@ FALSE is there is no room. In FireRed, this command is a nop. (The argument is read, but not used for anything.)
.macro checkdecorspace decoration:req .macro checkdecorspace decoration:req
.byte 0x4e .byte 0x4e
.2byte \decoration .2byte \decoration
@ -556,7 +566,10 @@
.endif .endif
.endm .endm
@ 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. @ 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. @ If no map is specified, then the current map is used.
.macro waitmovement index:req, map .macro waitmovement index:req, map
.ifb \map .ifb \map
@ -569,7 +582,9 @@
.endif .endif
.endm .endm
@ 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. @ 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. @ If no map is specified, then the current map is used.
.macro removeobject index:req, map .macro removeobject index:req, map
.ifb \map .ifb \map
@ -582,7 +597,8 @@
.endif .endif
.endm .endm
@ 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. @ 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. @ If no map is specified, then the current map is used.
.macro addobject index:req, map .macro addobject index:req, map
.ifb \map .ifb \map
@ -723,7 +739,8 @@
.endm .endm
@ 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. @ 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.
.macro trainerbattlebegin .macro trainerbattlebegin
.byte 0x5d .byte 0x5d
.endm .endm
@ -763,7 +780,8 @@
.2byte \y .2byte \y
.endm .endm
@ Copies a live object event's xy position to its template, so that if the sprite goes off screen, it'll still be there when it comes back on screen. @ Copies a live object event's xy position to its template, so that if the sprite goes off screen,
@ it'll still be there when it comes back on screen.
.macro copyobjectxytoperm index:req .macro copyobjectxytoperm index:req
.byte 0x64 .byte 0x64
.2byte \index .2byte \index
@ -775,12 +793,15 @@
.byte \byte .byte \byte
.endm .endm
@ 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. @ 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.
.macro waitmessage .macro waitmessage
.byte 0x66 .byte 0x66
.endm .endm
@ 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.) @ 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.)
.macro message text:req .macro message text:req
.byte 0x67 .byte 0x67
.4byte \text .4byte \text
@ -816,14 +837,16 @@
.byte 0x6d .byte 0x6d
.endm .endm
@ 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 VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO @ 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 VAR_RESULT as NO (0) or YES (1). Pressing B is equivalent to answering NO
.macro yesnobox x:req, y:req .macro yesnobox x:req, y:req
.byte 0x6e .byte 0x6e
.byte \x .byte \x
.byte \y .byte \y
.endm .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 (sMultichoiceLists) 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. @ 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 (sMultichoiceLists) 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.
.macro multichoice x:req, y:req, list:req, b:req .macro multichoice x:req, y:req, list:req, b:req
.byte 0x6f .byte 0x6f
.byte \x .byte \x
@ -832,7 +855,10 @@
.byte \b .byte \b
.endm .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 (sMultichoiceLists) 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. @ 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 (sMultichoiceLists) 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.
.macro multichoicedefault x:req, y:req, list:req, default:req, b:req .macro multichoicedefault x:req, y:req, list:req, default:req, b:req
.byte 0x70 .byte 0x70
.byte \x .byte \x
@ -842,7 +868,9 @@
.byte \b .byte \b
.endm .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 (sMultichoiceLists) 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. @ 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 (sMultichoiceLists) 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.
.macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req .macro multichoicegrid x:req, y:req, list:req, per_row:req, B:req
.byte 0x71 .byte 0x71
.byte \x .byte \x
@ -894,7 +922,9 @@
.byte \a .byte \a
.endm .endm
@ 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). @ 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).
.macro braillemessage text:req .macro braillemessage text:req
.byte 0x78 .byte 0x78
.4byte \text .4byte \text
@ -923,7 +953,9 @@
.2byte \move .2byte \move
.endm .endm
@ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE. VAR_0x8004 is also set to this Pokemon's species. @ Checks if at least one Pokemon in the player's party knows the specified (index) attack. If so, VAR_RESULT is set to the
@ (zero-indexed) slot number of the first Pokemon that knows the move. If not, VAR_RESULT is set to PARTY_SIZE.
@ VAR_0x8004 is also set to this Pokemon's species.
.macro checkpartymove index:req .macro checkpartymove index:req
.byte 0x7c .byte 0x7c
.2byte \index .2byte \index
@ -942,14 +974,16 @@
.byte \out .byte \out
.endm .endm
@ 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. @ 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.
.macro bufferpartymonnick out:req, slot:req .macro bufferpartymonnick out:req, slot:req
.byte 0x7f .byte 0x7f
.byte \out .byte \out
.2byte \slot .2byte \slot
.endm .endm
@ 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. @ 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.
.macro bufferitemname out:req, item:req .macro bufferitemname out:req, item:req
.byte 0x80 .byte 0x80
.byte \out .byte \out
@ -977,7 +1011,8 @@
.2byte \input .2byte \input
.endm .endm
@ 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. @ 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 crashes or garbage characters.
.macro bufferstdstring out:req, index:req .macro bufferstdstring out:req, index:req
.byte 0x84 .byte 0x84
.byte \out .byte \out
@ -1063,7 +1098,8 @@
.byte \check .byte \check
.endm .endm
@ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player has enough money, or FALSE if they do not. @ If check is 0x00, this command will check if the player has money >= value; VAR_RESULT is set to TRUE if the player
@ has enough money, or FALSE if they do not.
.macro checkmoney value:req, check:req .macro checkmoney value:req, check:req
.byte 0x92 .byte 0x92
.4byte \value .4byte \value
@ -1291,7 +1327,8 @@
.2byte \count .2byte \count
.endm .endm
@ 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. @ 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.
.macro setwildbattle species:req, level:req, item:req .macro setwildbattle species:req, level:req, item:req
.byte 0xb6 .byte 0xb6
.2byte \species .2byte \species
@ -1395,19 +1432,22 @@
.2byte \box .2byte \box
.endm .endm
@ 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. @ 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.
.macro textcolor color:req .macro textcolor color:req
.byte 0xc7 .byte 0xc7
.byte \color .byte \color
.endm .endm
@ 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. @ 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.
.macro loadhelp pointer:req .macro loadhelp pointer:req
.byte 0xc8 .byte 0xc8
.4byte \pointer .4byte \pointer
.endm .endm
@ 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. @ 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.
.macro unloadhelp .macro unloadhelp
.byte 0xc9 .byte 0xc9
.endm .endm
@ -1435,13 +1475,15 @@
.2byte \slot .2byte \slot
.endm .endm
@ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient, VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE. @ Checks if the Pokemon in the specified slot of the player's party is obedient. If the Pokemon is disobedient,
@ VAR_RESULT is TRUE. If the Pokemon is obedient (or if the specified slot is empty or invalid), VAR_RESULT is FALSE.
.macro checkmonobedience slot:req .macro checkmonobedience slot:req
.byte 0xce .byte 0xce
.2byte \slot .2byte \slot
.endm .endm
@ 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. @ 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 .macro gotoram
.byte 0xcf .byte 0xcf
.endm .endm
@ -1468,7 +1510,8 @@
.byte \location .byte \location
.endm .endm
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle specified by puzzleNumber one rotation @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Moves the objects on the colored puzzle
@ specified by puzzleNumber one rotation
.macro moverotatingtileobjects puzzleNumber:req .macro moverotatingtileobjects puzzleNumber:req
.byte 0xd3 .byte 0xd3
.2byte \puzzleNumber .2byte \puzzleNumber
@ -1479,7 +1522,9 @@
.byte 0xd4 .byte 0xd4
.endm .endm
@ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects. isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset the puzzle tiles start. In FireRed, this command is a nop. @ For the rotating tile puzzles in Mossdeep Gym/Trick House Room 7. Allocates memory for the puzzle objects.
@ isTrickHouse is needed to determine which of the two maps the puzzle is on, in order to know where in the tileset
@ the puzzle tiles start. In FireRed, this command is a nop.
.macro initrotatingtilepuzzle isTrickHouse:req .macro initrotatingtilepuzzle isTrickHouse:req
.byte 0xd5 .byte 0xd5
.2byte \isTrickHouse .2byte \isTrickHouse
@ -1551,7 +1596,10 @@
.2byte \word .2byte \word
.endm .endm
@ 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. @ 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.
.macro bufferitemnameplural out:req, item:req, quantity:req .macro bufferitemnameplural out:req, item:req, quantity:req
.byte 0xe2 .byte 0xe2
.byte \out .byte \out