Config Parser: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Fix redirection)
Tag: Redirect target changed
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
=Introduction =
#REDIRECT [[PreProcessor Commands#Config Parser]]
(needed)
 
 
= Parser commands/macros =
 
==__EXEC==
Allows you to assign values to variables. These variables can then be used to in other calculations, or output via the __EVAL macro.
 
<code>__EXEC (_x = .345);
__EXEC (_y = _y + 1);
__EXEC (_str = format["name: %1",_name])</code>
 
 
__EXEC terminates at the first closed parenthesis "''')'''" it encounters, so expressions like the following will cause an error:
 
<code>__EXEC (_val = (_arr select 0)*10); // ILLEGAL!
__EXEC (_str = (_this select 0) setDamage 1); // ILLEGAL!</code>
 
==__EVAL==
With this macro expressions can be evaluated, including previously assigned internal variables.
 
<code>y = __EVAL (_y);
text = __EVAL (_str1 + _str2);</code>
 
 
Unlike the __EXEC command, __EVAL ''can'' contain other parentheses, making more complex, and even conditional operations possible:
<code>x = __EVAL (if (_idx>5) then {0} else {.5});</code>
 
 
Be aware though, that if these evaluations are used in a mission's description.ext, that at that point the mission information is not available yet (i.e. the mission objects have not been created yet). (''At least in VBS2 this is the case.'')
 
[[category:Operation Flashpoint: Editing]]
[[Category:ArmA: Addon Configuration]]

Latest revision as of 13:03, 16 August 2021