Config Parser: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Added info how to "combine multiple stringtable keys")
Line 36: Line 36:


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.'')
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.'')
===Combine multiple stringtable keys===
__EVAL("Default: " + localize "STR_AAS_EXT_DISABLED")
__EVAL(localize "STR_AAS_EXT_DEFAULT" + localize "STR_AAS_EXT_DISABLED")
This works in the [[Description.ext]] at least.


[[category:Operation Flashpoint: Editing]]
[[category:Operation Flashpoint: Editing]]
[[Category:ArmA: Addon Configuration]]
[[Category:ArmA: Addon Configuration]]

Revision as of 17:53, 19 July 2011

Introduction

(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.

__EXEC (_x = .345); __EXEC (_y = _y + 1); __EXEC (_str = format["name: %1",_name])


__EXEC terminates at the first closed parenthesis ")" it encounters, so expressions like the following will cause an error:

__EXEC (_val = (_arr select 0)*10); // ILLEGAL! __EXEC (_str = (_this select 0) setDamage 1); // ILLEGAL!

__EVAL

With this macro expressions can be evaluated, including previously assigned internal variables.

y = __EVAL (_y); text = __EVAL (_str1 + _str2);


Unlike the __EXEC command, __EVAL can contain other parentheses, making more complex, and even conditional operations possible: x = __EVAL (if (_idx>5) then {0} else {.5});


If you need to make use of a #defined value in your __EXEC or __EVAL string and you need to convert it to string using 'str', remember not to add extra brackets like this: onSliderPosChanged = __EVAL("[" + str (MY_NUMERIC_DEFINE) + "] call compile preProcessFile 'my.sqf'"); The above will fail when parsing the __EVAL, the correct line would be: onSliderPosChanged = __EVAL("[" + str MY_NUMERIC_DEFINE + "] call compile preProcessFile 'my.sqf'");


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.)

Combine multiple stringtable keys

__EVAL("Default: " + localize "STR_AAS_EXT_DISABLED")
__EVAL(localize "STR_AAS_EXT_DEFAULT" + localize "STR_AAS_EXT_DISABLED")

This works in the Description.ext at least.