Repository navigation
Declaring Commands
To use a command in the console, first it needs to be declared in the Commands code block inside the Create event for obj_console. You can use the console_add() script to declare new commands. This script takes 4 arguments:
The name of the command. This is what the user will enter into the console to execute the command.
This sets whether the command can only be executed if the variable con_admin is set to true in console configuration.
This sets whether the command can only be executed if the variable con_admin is set to true in the configuration settings for the console.
Here you can set the expected arguments for the command, if there are any. These should be split up with a comma. If the user does not include these arguments when trying to execute the command, the command is not executed.
Here you can set the expected data types for the arguments, if there are any. These should be split up with a comma. If the submitted arguments do not match the corresponding data types then the command is not executed. Should be either 'real' or 'string' type, but you can declare other types in User Defined Event 4.
console_add("game_end",false);
console_add("wmode",false,"toggle","bool");
console_add("score",true,"amount","real");
console_add("create_powerup",true,"x,y","real,real");
Once a command is declared, you can tell the console what to do when the command is entered. See: Executing Commands