missionConfigFile: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "description.ext" to "description.ext")
m (Some wiki formatting)
Line 29: Line 29:
|r1= [[Config]]
|r1= [[Config]]


|x1= <code>[[for]] "_i" [[from]] 0 [[to]] ([[count]] [[paramsArray]] - 1) [[do]]
|x1= <sqf>
for "_i" from 0 to (count paramsArray - 1) do
{
{
[[missionNamespace]] [[setVariable]] [<nowiki/>[[configName]] (([[missionConfigFile]]/"Params") [[select]] _i), [[paramsArray]] [[select]] _i];
missionNamespace setVariable [configName ((missionConfigFile/"Params") select _i), paramsArray select _i];
};</code>
};
</sqf>


|x2= To define custom values in [[Description.ext|description.ext]]:
|x2= To define custom values in [[Description.ext|description.ext]]:
Line 48: Line 50:


To read defined custom values from a script:
To read defined custom values from a script:
<code>_myNumber = [[getNumber]] ([[missionConfigFile]] [[gtgt|>>]] "myMissionConfig" [[gtgt|>>]] "mySetup" [[gtgt|>>]] "myNumber");<br><!--
<sqf>
-->_myArray = [[getArray]] ([[missionConfigFile]] [[gtgt|>>]] "myMissionConfig" [[gtgt|>>]] "mySetup" [[gtgt|>>]] "myArray");<br><!--
_myNumber = getNumber (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myNumber");
-->_myText = [[getText]] ([[missionConfigFile]] [[gtgt|>>]] "myMissionConfig" [[gtgt|>>]] "mySetup" [[gtgt|>>]] "myText");</code>
_myArray = getArray (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myArray");
_myText = getText (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myText");
</sqf>


|seealso=[[configFile]] [[campaignConfigFile]] [[getMissionConfigValue]] [[getMissionConfig]] [[getMissionPath]]
|seealso=[[configFile]] [[campaignConfigFile]] [[getMissionConfigValue]] [[getMissionConfig]] [[getMissionPath]]
}}
}}
<dl class="command_description">


<dt></dt>
{{Note
<dd class="notedate">Posted on February 17, 2015 - 16:46 (UTC)</dd>
|user= Killzone_Kid
<dt class="note">[[User:Killzone Kid|Killzone Kid]]</dt>
|timestamp= 20150217164600
<dd class="note">
|text= [[missionConfigFile]] can be used to parse ''mission.sqm'' file data as well if it is included into [[Description.ext|description.ext]]:
[[missionConfigFile]] can be used to parse ''mission.sqm'' file data as well if it is included into [[Description.ext|description.ext]]:
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
class MissionSQM
class MissionSQM
Line 68: Line 70:
</syntaxhighlight>
</syntaxhighlight>
Then ''mission.sqm'' data can be accessed like this:
Then ''mission.sqm'' data can be accessed like this:
<code>[[getNumber]] ([[missionConfigFile]] >> "MissionSQM" >> "version"); //12 - version param in ''mission.sqm''</code>
<sqf>getNumber (missionConfigFile >> "MissionSQM" >> "version"); // 12 - version param in mission.sqm</sqf>
(courtesy of [[Special:Contributions/Master85|Master85]])
(courtesy of [[Special:Contributions/Master85|Master85]])
</dd>
}}


<dt></dt>
{{Note
<dd class="notedate">Posted on April 27, 2018 - 20:39 (UTC)</dd>
|user= Dedmen
<dt class="note">[[User:Dedmen|Dedmen]]</dt>
|timestamp= 20180427203900
<dd class="note">
|text= If your [[Description.ext]] file is empty, [[str]] [[missionConfigFile]] may report an empty string instead of the path to the file. You have to put at least one entry into your config.<br>
If your [[Description.ext]] file is empty, [[str]] [[missionConfigFile]] may report an empty string instead of the path to the file. You have to put at least one entry into your config.<br>
To get file path with [[Description.ext|description.ext]] to play sound via [[playSound3D]] (before [[getMissionPath]]):
To get file path with [[Description.ext|description.ext]] to play sound via [[playSound3D]] (before [[getMissionPath]]):
<code>MISSION_ROOT = [[str]] [[missionConfigFile]] [[select]] [0, [[count]] [[str]] [[missionConfigFile]] - 15];</code>
<sqf>private _missionRootPath = str missionConfigFile select [0, count str missionConfigFile - 15];</sqf>
</dd>
}}
 
</dl>

Revision as of 15:51, 2 May 2022

Hover & click on the images for description

Description

Description:
Return root of mission Description.ext entries hierarchy.
Since the introduction of the Eden Editor, scenario attributes can be configured in the editor itself, not only in the external Description.ext file.

To access desired value independently on where it is stored, use the following commands:

Groups:
Config

Syntax

Syntax:
missionConfigFile
Return Value:
Config

Examples

Example 1:
for "_i" from 0 to (count paramsArray - 1) do { missionNamespace setVariable [configName ((missionConfigFile/"Params") select _i), paramsArray select _i]; };
Example 2:
To define custom values in description.ext:
class myMissionConfig
{
	class mySetup
	{
		myNumber = 3;
		myArray[] = { 1, 2, 3 };
		myText = "LOL";
	};
};

To read defined custom values from a script:

_myNumber = getNumber (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myNumber"); _myArray = getArray (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myArray"); _myText = getText (missionConfigFile >> "myMissionConfig" >> "mySetup" >> "myText");

Additional Information

See also:
configFile campaignConfigFile getMissionConfigValue getMissionConfig getMissionPath

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Killzone_Kid - c
Posted on Feb 17, 2015 - 16:46 (UTC)
missionConfigFile can be used to parse mission.sqm file data as well if it is included into description.ext:
class MissionSQM
{
	#include "mission.sqm"
};

Then mission.sqm data can be accessed like this:

getNumber (missionConfigFile >> "MissionSQM" >> "version"); // 12 - version param in mission.sqm
(courtesy of Master85)

Dedmen - c
Posted on Apr 27, 2018 - 20:39 (UTC)
If your Description.ext file is empty, str missionConfigFile may report an empty string instead of the path to the file. You have to put at least one entry into your config.
To get file path with description.ext to play sound via playSound3D (before getMissionPath):
private _missionRootPath = str missionConfigFile select [0, count str missionConfigFile - 15];