Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CBA_fnc_getMacro #1715

Merged
merged 2 commits into from
Dec 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions addons/common/CfgFunctions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ class CfgFunctions {
PATHTO_FNC(deleteNamespace);
PATHTO_FNC(allNamespaces);
PATHTO_FNC(directCall);
PATHTO_FNC(getMacro);
PATHTO_FNC(objectRandom);
PATHTO_FNC(execNextFrame);
PATHTO_FNC(execAfterNFrames);
Expand Down
44 changes: 44 additions & 0 deletions addons/common/fnc_getMacro.inc.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
switch (_this) do {
case "__DATE_ARR__": { [__DATE_ARR__] }; // [2024,11,10,16,19,39]
case "__DATE_STR__": { __DATE_STR__ }; // "2024/11/10, 16:19:39"
case "__DATE_STR_ISO8601__": { __DATE_STR_ISO8601__ }; // "2024-11-10T22:19:39Z"
case "__TIME__": { '__TIME__' }; // 16:19:39 (quoted because invalid number)
case "__TIME_UTC__": { '__TIME_UTC__' }; // 22:19:39
case "__TIMESTAMP_UTC__": { '__TIMESTAMP_UTC__' }; // 1731277179 (quoted because float will not have precision for 32+ bits)
case "__DAY__": { __DAY__ }; // 10
case "__MONTH__": { __MONTH__ }; // 11
case "__YEAR__": { __YEAR__ }; // 2024
case "__GAME_VER__": { '__GAME_VER__' }; // 2.18.152302 (quoted because invalid number)
case "__GAME_VER_MAJ__": { __GAME_VER_MAJ__ }; // 2
case "__GAME_VER_MIN__": { __GAME_VER_MIN__ }; // 18
case "__GAME_BUILD__": { __GAME_BUILD__ }; // 152302
case "__A3_DIAG__": {
#if __A3_DIAG__
true
#else
false
#endif
};
case "__A3_DEBUG__": {
#if __A3_DEBUG__
true
#else
false
#endif
};
case "__A3_EXPERIMENTAL__": {
#if __A3_EXPERIMENTAL__
true
#else
false
#endif
};
case "__A3_PROFILING__": {
#if __A3_PROFILING__
true
#else
false
#endif
};
default { "ERROR-invalid macro"};
}
25 changes: 25 additions & 0 deletions addons/common/fnc_getMacro.sqf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include "script_component.hpp"
/* ----------------------------------------------------------------------------
Function: CBA_fnc_getMacro

Description:
Gets the value of special macros

Parameters:
0: Macro Name <STRING>

Returns:
None

Examples:
(begin example)
"__DATE_ARR__" call CBA_fnc_getMacro;
(end)

Author:
PabstMirror
---------------------------------------------------------------------------- */

params ["_macro"];

_macro call compileScript [QPATHTOF(fnc_getMacro.inc.sqf)]
Loading