Jump to content
Sign in to follow this  
jakkob4682

The right way to use all the config related commands?

Recommended Posts

I've gone over the wiki several times trying to figure out how use them to do simple things such as get the type of a certain group, display locations on a map, etc. I am a complete noob when it comes to using the commands that deal with configs though. So if someone would kind enough to give me an example(not out of the wiki) and explain its function such as getText, getArray, configName, I'd be very appreciative. Even if you know of a better guide other than the wiki that'd be awesome if you don't feel like going into detail.

Share this post


Link to post
Share on other sites
I've gone over the wiki several times trying to figure out how use them to do simple things such as get the type of a certain group, display locations on a map, etc. I am a complete noob when it comes to using the commands that deal with configs though. So if someone would kind enough to give me an example(not out of the wiki) and explain its function such as getText, getArray, configName, I'd be very appreciative. Even if you know of a better guide other than the wiki that'd be awesome if you don't feel like going into detail.

if I use something like

_infantry = configName(configFile>>"CfgGroups">>"West">>"USMC">>"INFANTRY">>"FireTeam")
_FireTeam = [];
//how then would I use this to get either number of USMC_FireTeam groups or to check if a certain is of defined type? 
{

[indent][/indent]if (_x = getArray _infantry) then {
[indent][/indent]



[indent][/indent]_FireTeam = _FireTeam + [_x]
[indent][/indent]

}forEach allGroups?

Share this post


Link to post
Share on other sites

These commands are used to access parts of the config. You use the correct command depending on what you want to retrieve.

Here is the config I used in the example:

http://browser.six-projects.net/cfg_weapons/M4A1/config?version=65

// getText
// Use this command to get an item that is stored in the config as text.
//
_text = getText (configFile >> "CfgWeapons" >> "M4A1" >> "displayname");




// getArray
// Use this command to get an item that is stored in the config as an array.
//  
_array = getArray (configFile >> "CfgWeapons" >> "M4A1" >> "modes");




// getNumber
// Use this command to get an item that is stored in the config as an number or integer.
//  
_number = getNumber (configFile >> "CfgWeapons" >> "M4A1" >> "value");

You use the is commands to check what the return result is, if you do not know what it will return or if it is there.


// Use to check if the class is defined.
if (isClass(configFile >> "CfgPatches" >> "ace_main")) then
{
    ///... do some stuff is ACE is running(Could check for any addon or config entry.
} else
{
   // .... Do something else.
};

// Use to check if that is the data type...
_ok = isArray (configFile >> "CfgWeapons" >> "M4A1" >> "drysound");

if (_ok) then { hint "We Have sounds when we run the weapon dry.";};

Share this post


Link to post
Share on other sites

so how would I check if group _x isArray()?

---------- Post added at 03:08 ---------- Previous post was at 03:07 ----------

or should I use isClass instead?

Edited by jakkob4682
spelling

Share this post


Link to post
Share on other sites

hint format ["%1",count (configFile >> "CfgGroups">>"West">>"USMC">>"INFANTRY")-1];

I think that is correct - returns 9 - there are 9 entries in the cfgGroups here:

http://browser.six-projects.net/cfg_groups

Here is another favourite - find out what planet you're on lol:

hint format ["%1 is on %2",name player, getText (configFile>>"CfgWorlds">>worldName>>"description")];

Share this post


Link to post
Share on other sites

what about if the group is unknown and it enter into a trigger/array area and I want to find out if its a USMC_FireTeam_MG or USMC_FireTeam_Support?

Share this post


Link to post
Share on other sites

Inadvisable - if just 1 group member is killed the array of group members will not match the cfg array? If you can guarantee 100% that they will all be alive well I will look at it tomorrow for you.

I would preferably check the group members for AT weapons or MG's? Or store the group names in arrays and check the group name against the array?

Share this post


Link to post
Share on other sites

yes but using typeOf _x for a group doesnt work, so I'm guessing using isArray the way to go?

---------- Post added at 03:44 ---------- Previous post was at 03:35 ----------

checking for certain weapons sounds good but dont regular fire teams and machine gun teams both have a machine gunner? or am i mistaken, not sure if the reg fire team has a MG or an AR tbh

---------- Post added at 03:46 ---------- Previous post was at 03:44 ----------

sorry for asking so many question but i'm trying to sponge up as much knowledge I can, and not being an experienced scripter when I look at a complicated script that uses a ton of variables and loops and etc i get lost.

Share this post


Link to post
Share on other sites

It may be easier, if you are creating these groups via script, to use setVariable on the group, and then getVariable of the group in the trigger to match your condition.

_grp setVariable ["GroupType", USMC_FireTeam_MG, true];

condition in trigger:

group this getVariable "GroupType" == USMC_FireTeam_MG

Not tested, but worth a shot...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×