You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The assembler-macros used for compilation of field, battle, and trainer AI scripting use a a magic number-sequence to translate macro inputs into the byte-code understood by the game's internal script-processing engines. These numbers are processed by the engines as indices into a respective function table. This is a bit brittle, as it's easy for a modder to create a new scripting command for any engine, create an assembler-macro for the next element in the sequence, and accidentally inject their new function at the wrong place in the respective function table.
Proposal
We should generate a set of constants for use by each class of scripting's associated assembler-macros and function-tables. To illustrate, such constants would be made use of like so:
One clear negative to this approach is that it adds some additional boilerplate for a modder when it comes to creating a new scripting command. However, there is also a clear authoritative association between macros and function-table, allowing a user to quickly jump between the two concepts without needing to sift through potentially many scripts making use of their command.
The text was updated successfully, but these errors were encountered:
Problem Statement
The assembler-macros used for compilation of field, battle, and trainer AI scripting use a a magic number-sequence to translate macro inputs into the byte-code understood by the game's internal script-processing engines. These numbers are processed by the engines as indices into a respective function table. This is a bit brittle, as it's easy for a modder to create a new scripting command for any engine, create an assembler-macro for the next element in the sequence, and accidentally inject their new function at the wrong place in the respective function table.
Proposal
We should generate a set of constants for use by each class of scripting's associated assembler-macros and function-tables. To illustrate, such constants would be made use of like so:
In
asm/macros/scrcmd.inc
:In
src/scrcmd.c
:One clear negative to this approach is that it adds some additional boilerplate for a modder when it comes to creating a new scripting command. However, there is also a clear authoritative association between macros and function-table, allowing a user to quickly jump between the two concepts without needing to sift through potentially many scripts making use of their command.
The text was updated successfully, but these errors were encountered: