I'm specifically looking for the implementation file for \asm\macros\event.inc.
here is an example of one of those macros:
@ 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.
.macro checkpartymove index:req
.byte 0x7c
.2byte \index
.endm
it doesn't say anything about the variables listed in the comment in the chunk beneath it but it does interact with a pointer and it's parameters, which is making me think that this is just a set of declarations to allow compile-time functions to use run-time code. I'm thinking that it calls the function starting at the byte 0x7c with a parameter 2 bytes large that has been given the arbitrary name index so it can be passed through. but I can't confirm that as I can't trace down the function with that pointer.
the reason I want to find the implementation is to see if I can't put together a similar macro to the one above, only checking for a specific held item rather than a specific move (can't find one that exists already). I would do this at run-time, but as far as I can see the field-move triggers from when you press the a button on water or a cut-tree trace to \data\event_scripts.s and \data\scripts\field_move_scripts.inc respectively. there is a badge check and a move check in each these scripts. I want to allow the user to use field moves if they have a pokemon with the move, or they have a pokemon holding a specified item. I got the items working from the party menu (you can use flash, cut grass, heal with soft boiled, and others) but this is blocking my way when it comes to the field triggers.
here is an example of one of those macros:
@ 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.
.macro checkpartymove index:req
.byte 0x7c
.2byte \index
.endm
it doesn't say anything about the variables listed in the comment in the chunk beneath it but it does interact with a pointer and it's parameters, which is making me think that this is just a set of declarations to allow compile-time functions to use run-time code. I'm thinking that it calls the function starting at the byte 0x7c with a parameter 2 bytes large that has been given the arbitrary name index so it can be passed through. but I can't confirm that as I can't trace down the function with that pointer.
the reason I want to find the implementation is to see if I can't put together a similar macro to the one above, only checking for a specific held item rather than a specific move (can't find one that exists already). I would do this at run-time, but as far as I can see the field-move triggers from when you press the a button on water or a cut-tree trace to \data\event_scripts.s and \data\scripts\field_move_scripts.inc respectively. there is a badge check and a move check in each these scripts. I want to allow the user to use field moves if they have a pokemon with the move, or they have a pokemon holding a specified item. I got the items working from the party menu (you can use flash, cut grass, heal with soft boiled, and others) but this is blocking my way when it comes to the field triggers.