Console Commands
This package allows you to create new console commands.
Dependencies
Initialization
Initialize with LeGo_ConsoleCommands
flag.
Implementation
Functions
CC_Register
Registers a new console command.
var func f
This function is executed when thecmdPrefix
command is entered in the console. The function signature isfunc string f(var string p0)
. The string passed is everything that was specified in the console after the actual command. The return value is then displayed in the console.var string cmdPrefix
This is a command, which can be entered in the console.var string description
This text appears next to the command (in zSpy) when you use thehelp
command in the console.
CC_Remove
Removes a function from the console commands.
var func f
This function will be removed, i.e. the associated command will no longer work.
CC_Active
Checks whether the function passed is already part of a console command.
var func f
Function being checked
Return value
The function returns TRUE
if there is a corresponding function, FALSE
is returned otherwise.
Examples
Basic command example
As a basic example - let us create a version command, which prints a version of our modification.
Firstly, we declare a constant string
variable to hold the version string to be shown.
Note
Notice the correct function signature. If you do not adhere to the correct function signature, the command will crash the game.
RegisterConsoleFunctions
function to initialize all console commands. The function is really simple. INIT_GLOBAL
function.