Nuclear Throne Together' mods are written in a custom programming language that is most akin to GameMaker' Language.
The syntax is intended to be compatible with GML, and numerous built-in functions are supported, meaning that most concepts and solutions to problems still can be used.
There's also a number of additional features intended to make scripting easier/faster/more convenient.
NTT' mods are made up of one or more
.gml files containing the mod' code.
The files do not have to be compiled, and no additional tools are required to edit them, though it is recommended that you use a code editor with syntax highlighting for convenience, such as Notepad++ or FlashDevelop.
The process is much akin to what is done when loading mods - you make a "mods" directory, you place your files in there, and you load them up via
/loadmod after changing (or, alternatively, use
/loadlive to auto-reload it whenever the file changes).
For example, you could create a file called
open it with your editor of choice, add a single line of code into it,
, save it, and upon doing
/loadmod test you would see a "Hello!" line showing up in chat.
At most times you'll need to define more than one script per file. This is done by adding a "separator" directive before the script' contents, like so:
say("Hello!"); #define game_start say("Game start!"); #define say(what) trace(what);
Select scripts, such as
game_start here, will be called by the game at various occasions, if defined. You can read more about them on according mod type' pages.
After making the shown changes and [re-]loading the mod again via
/loadmod test, you would see it show "Hello!" when loaded and "Game start!" whenever starting a new run.
/gmlapi command populates the
api directory in the game's save directory (paste
%LOCALAPPDATA%/nuclearthrone/api into Explorer's address bar to quickly navigate there) with files containing various information about NTT's scripting API:
api.gml: Contains a list of all functions, variables, and constants that can be used in scripting.
A plenty of functions mirror the ones used in GameMaker itself (meaning that you can use official documentation) for them.
NTT-specific functions are either annotated with comments or described on this wiki.
fields.gml: Contains a list of all game' objects and their variables.
While for technical reasons it is not possible to view/edit existing game logic while the game is running, you are free to manipulate majority of game' objects as you see fit, creating instances, destroying them, or adjusting their numerous variables (listed).
raw-: A number of files containing "raw" lists of function/variable/constant/asset names, for configuring external editors to highlight NTT's language correctly.
Explore the wiki
There's a handful of pages describing what there is and how things work.
Study the existing code
There are numerous existing mods made for NTT.
Studying the existing code can be helpful to figure out ways of doing things.
Ask around, participate in community
There's a popular Discord server for the game, which spots a number of modding-specific channels that you can ask and and answer questions in.
Have fun !