Macros
Macros, like C macros, allow you to create shorthands which will then be expanded before the command is parsed. Macros are defined using #define
in the Quantum Console, or QuantumMacros.DefineMacro
#define pi 3.14
#define reset-player "teleport player (0, 0, 0)"
Macros can then be used within the console input my prepending them with the #
as such,
rotate object (0, 0, #pi)
#reset-player
The usage of the #
operator causes the macro to be expanded before parsing the input. Macros may not contain hashtags or whitespace in their name.
Note
Macros will not be expanded when defining a new macro (#define
or QuantumMacros.DefineMacro
), this is so that defining nested macros is possible
Nested Macros
Macro expansions may contain other macros enabling you to create nested macros This makes complex and dynamic macros easier to set up.
#define num 5
#define array [#num, #num, 20]
With these macros defined, #array
fully expand to [5, 5, 20]
.
If #num
was redefined to 10
, then #array
would expand to [10, 10, 20]
API Usage
For programmatically using macros, see [QuantumMacros]