Jump to content
Sign in to follow this  
[frl]myke

Gather classlist from special config

Recommended Posts

Ok, what i need is a simple list (array) with classes.

The config generally looks like this:

class cfgIAWSweapons {
   class default {
       scope = 0;
       type = "";
       uipicture = "";
       length = 0;
       width = 0;
       diameter = 0;
       weight = 0;
       allowWingtip = true;
       usedBy[] = {};
   };
};

The main class "cfgIAWSweapons" is similar to what cfgVehicles is, so "default" is a undelying class like "A10". Other classes might be inherited from "default" or being standalone, means no inheritance given.

The script i try to use looks like this:

IAWS_collectWeaponsList = {
   _list = [];
   for [{_i=0},{_i<(count(configFile >> "cfgIAWSweapons")-1)},{_i=_i+1}] do {
       _cfg_entry = (configFile >> "cfgIAWSweapons") select _i;
       if (isClass _cfg_entry) then {
           _scope = getNumber (configFile >> "cfgIAWSweapons" >> (configName _cfg_entry));
           if (_scope == 1) then {
               _list set [_i, _cfg_entry];
           };
       };
   };
   missionNamespace setVariable ["IAWS_weapons_list", _list];
};

It is WIP so procedures may change once i got it working (means final arrays and variables might be handled different).

I tried to hint the value of the variable "_cfg_entry" which prompted me just a "any". The rpt fills with this:

Warning Message: 'bin\config.bin/cfgIAWSweapons/default/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM114_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM114K_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM154A1_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM154A_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM65_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM65E_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM84_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AGM88_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM120_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM132_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM54_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM7_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM9M_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AIM9X_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_ANAAQ28/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AS4_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_CH15_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_CH29L_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_CH29T_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_CH59_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_AM39_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_FAB250_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_FAB500_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_FFARPod/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_GBU12_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_GBU24_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_GBU28_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_GBU53_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_GBU39_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_KAB1500_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_KAB250_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_KAB500_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_KAB500SE_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_CH31_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_R550_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_METEOR_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_MICA_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_MK81_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_MK82_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_MK84_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_R27_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_R3_Launcher/' is not a value
Warning Message: 'bin\config.bin/cfgIAWSweapons/FRL_R73_Launcher/' is not a value

This tells me, generally it does find the classes but they don't get handled in a manner as i would expect it.

Any ideas?

:EDITH:

Disregard, problem solved. Thanks to Sickboy and BIS Forum search (yeah i should know it: search before posting...hell, it was late): http://forums.bistudio.com/showthread.php?125451-Get-markers-class&p=2030589&viewfull=1#post2030589

Fixed script:

if (isNil "IAWS_collectWeaponsList") then {
   IAWS_collectWeaponsList = {
       _list = [];
       _config = configFile >> "cfgIAWSweapons";
       for "_i" from 0 to (count _config) - 1 do {
           _entry = _config select _i;
           if (isClass _entry) then {
               if ((getNumber (configFile >> "cfgIAWSweapons" >> (configName _entry) >> "scope")) == 1) then {
                   _list set [count _list, configName _entry];
                   hintsilent format ["%1", _entry];
               };
           };
       };
       missionNamespace setVariable ["IAWS_weapons_list", _list];
   };
};

Edited by [FRL]Myke

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  

×