Skip to content

Functions

Grisgram edited this page Sep 1, 2024 · 4 revisions

ARGS is an instance of the CommandLineArgs class provided with the local package.

This class also captures all GameMaker Command Line Parameters.

Tip

It is worth to note, that the GameMaker Command Line Arguments, according to the documentation above, all start with a - character, and not with --. So, the ARGS class will interpret all these parameters as switches (see below).

Use these methods to investigate the command line parameters you received:

ARGS
    .count
    .exe_name

    .has_switch(...)
    .get_switch(...)
    .is_switch_enabled(...)

    .has_option(...)

    .has_command(...)
    .get_command(...)

count and exe_name

Those variables hold the number of parameters specified and the name of the executable that is currently running.

All Other Functions

All other functions receive two arguments:

  • name -- The name of the switch/option/command you are looking for case_sensitive-- Default isfalse, whether to do a case_sensitive search for the name or not (in almost all thinkable scenarios you will want to leave this at its default value of false`)

Example: if (ARGS.has_switch("console")) initialize_debug_console();
For more examples, make sure, you look through Example Code.

Direct Access

If you do not want to use the methods above, you may also access the internal arrays directly, so you can loop through them.

The internal arrays are named as:

ARGS
    .args[]       // All arguments in the order they were supplied
    .switches[]
    .options[]
    .commands[]

To see, how this can work in your game, take a look at the Example Code page.

Clone this wiki locally