/gmlapi in NTT

If you run the /gmlapi command in chat, NTT will create an api folder in your save directory with a couple files in it.

api.gml
api.gml

This file contains describes all of the mod-accessible global functions, variables, and constants.

The contents can include:

Comments

GML-style, single-line (// text) or multi-line (/* text */).

Constants

These can look like so:

ev_create#
ev_destroy = 1
Variables

These can look like so:

room_speed
current_time*
view_xview[player]*

If something has a [index] after it, that's an array.

If something has a * after it, that's read-only.

Functions
Functions

These can look like so:

trace(...values)
sqrt(x):#
array_create(size, [value]):
struct_get(ctx, varname:string):
:alarm_set(index, value)
Prefixes

Function definitions may be preceded by one of the following:

  • :: a function accesses something from self.
    You'll see this on most instance-related functions.
  • ::: a function accesses something from self and other.
    Currently this is only used for event_perform, which may need other for collision events.
  • :::: a function accesses something from self and maybe other.
    This is a silly workaround for weapon functions accidentally relying on other and will likely be replaced with a ${tag} in the future.
  • ${tag}: special function tags.
    These are mostly for special-case functions.

If you are parsing api.gml, you can presume these to be (\$\{\w+}|:+)? and be done with it.

Suffixes

Function definitions may be followed by one or more of the following:

  • :: the function returns something.
    A function without this marker might still have a return value - this was only necessary in older GM versions where you could not reference built-in functions by doing something like

    var f = instance_exists;
    
  • :type: the function returns a specific type.
    Very few functions have their return types marked at the moment as this information is only useful for external editors.
  • #: the function is "pure" and can be evaluated during compilation if called with constant arguments.
  • $: US English spelling
  • £: UK English spelling
Name-list files

Each of these has just the names of one or other thing.

These are good for syntax highlighting and for editors that cannot parse api.gml.

  • raw-assets.gml: All the assets.
    If you're already parsing api.gml, this is the only file you that you need to parse.
  • raw-sprites.gml
  • raw-sounds.gml
  • raw-fonts.gml
  • raw-objects.gml
  • raw-functions.gml
  • raw-variables.gml
  • raw-constants.gml
fields.gml

This file is no longer generated by current versions of NTT because there is no longer a whitelist of allowed variable names per object.

For purposes of figuring out what objects do, see NTT-Objects.