Scripting: Preprocessor Macros – Arma Reforger

From Bohemia Interactive Community
Revision as of 17:00, 30 June 2024 by Lou Montana (talk | contribs) (Page creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Preprocessor macros provide helpful context information, especially useful in debug.

Macro Description Example

__FILE__

Is replaced by a string containing the current file's relative path.
Print(__FILE__, LogLevel.NORMAL); // ends as e.g Print("scripts/WorkbenchGame/ScriptEditor/TAG_MyTestPlugin.c", LogLevel.NORMAL); // this is absolutely valid string absPath; Workbench.GetAbsolutePath(__FILE__, absPath, true); Print(absPath); // e.g "D:/MyMods/TAG_MyMod/scripts/WorkbenchGame/ScriptEditor/TAG_MyTestPlugin.c"

__LINE__

Is replaced by a string containing the current file's line number.
Print(__LINE__ + 2, LogLevel.NORMAL); // ends as Print("4" + 2, LogLevel.NORMAL); // "42"