Wiki
Clone wikiNuclearThroneTogether / Scripting / API / Script binding
Mod development sometimes requires you to have code that executes at some particular time or depth.
While most mod types offer at least two callbacks (step and draw), these are often not sufficient to accomplish the goals.
For this reason, Nuclear Throne Together features a number of functions that allow to make a script execute in a particular event and at a particular depth:
script_bind_begin_step(script, depth:number, ...args) script_bind_step(script, depth:number, ...args) script_bind_end_step(script, depth:number, ...args) script_bind_draw(script, depth:number, ...args)
example.mod.gml:
#define step with (Player) if (button_pressed(index, "horn")) { with (script_bind_draw(scr_test, -10, mouse_x[index], mouse_y[index], "Hello!")) { time = 0; } } #define scr_test(dx, dy, text) draw_text_nt(dx, dy, text); time += 1; if (time >= 90) instance_destroy();
script_ref_create
A somewhat close relative of script_bind_
functions, script_ref_create
is used for creating script references for custom object' event callback variables. The syntax is as following:
script_ref_create(script, ...args)
Updated