Documentation

The preprocessor

Openplanet's Angelscript compiler comes with a preprocessor (based on ccpp). You can use this to selectively omit specific lines of code from the actual script compilation. For example:

#if TMNEXT
  print("I am running on Trackmania (2020)");
#elif MP4
  print("I am running on Maniaplanet 4");
#else
  print("I am running on a different game");
#endif

Defines may be combined using the operators && (and) and || (or). Note that currently these operators are very basic and do not adhere to any specific order of operations, and you can not group them using parenthesis. In other words: the conditions are tested from left to right no matter what.

Available defines

The following is a list of all available preprocessor defines, including ones that are generally not available publicly:

Define Defined when..
UNITED The current game is Trackmania United
MP3 The current game is Maniaplanet 3
TURBO The current game is Trackmania Turbo
MP4 The current game is Maniaplanet 4 (this includes both 4.0 and 4.1)
MP40 The current game is Maniaplanet 4.0
MP41 The current game is Maniaplanet 4.1
TMNEXT The current game is Trackmania (2020)
LOGS The current game is a Logs-configured build (for example, Nadeo development builds or the "logs" executables)
HAS_DEV The current game is a Nadeo development build
SERVER The current game is a dedicated server build
MANIA64 The current game is a 64-bit build
MANIA32 The current game is a 32-bit build
WINDOWS The current OS is Windows
WINDOWS_WINE The current OS is Windows through WINE
LINUX The current OS is Linux
DEVELOPER The current Openplanet build is a debug build

Defines for signature modes

Signature modes have their own preprocessor defines. They are defined when the current signature level is equal or below their respective level:

Current / Define SIG_OFFICIAL SIG_REGULAR SIG_SCHOOL SIG_DEVELOPER
Official
Regular
School
Developer

Defines for competition profiles

Competition profiles have a define with the COMP_ prefix. For example, a competition like "Bob's Cool Competition" may have an ID of BOB, in which case COMP_BOB will be defined. Additional defines may be configured. If you need more defines for your competition profile, let us know and we can set it up.


Page updated 2 days ago by Miss(Trusted developer)