You can define functions in NTGML mods like you define them in GML scripts:
function step() { // ... } trace("hi!") function add(a, b) { return a + b; }
Any code outside of functions will be automatically added to the init
function
that runs when your mod is loaded.
You may also define functions similar to how it's done in GM extensions:
trace("hi!"); #define step // ... #define add(a, b) return a + b;
Any code before the first function will be added to the init
function.
A small convenience is added support for named arguments, which GM extensions do not have.
You may use either of formats, but not both at once;
Legacy format can only use #define
-based declarations.