Jump to content
Sign in to follow this  
fight9

[SNIPPET] Export Ranked CfgWeapons by Mass

Recommended Posts

This was something I wrote quickly to see how mass is configured through different CfgWeapon Items. I thought I would share in case some one else was interested. Hopefully this can help someone else down the line - maybe not with mass, but sorting configs in general.

Just spawn or execVM the code

Export example:

RANK | MASS | NAME | CLASSNAME

129. 120 | ASP-1 Kir 12.7mm (Black) | srifle_DMR_04_ARCO_F

130. 120 | ASP-1 Kir 12.7mm (Black) | srifle_DMR_04_NS_LP_F

...

133. 120 | Mk14 7.62mm (Camo) | srifle_DMR_06_camo_khs_F

134. 120 | NLAW (Used) | INKO_NLAW_USED

135. 117 | M32 MGL | M32

...

139. 100 | Rahim 7.62 mm | srifle_DMR_01_F

...

294. 50 | Sting 9Â***mm | SMG_02_ARCO_pointg_F

295. 50 | Guerilla Smocks | U_BG_Guerilla3_1

296. 50 | Raven Vest | V_TacVestIR_blk

297. 50 | SF Helmet | H_HelmetSpecB

Code:

[color="#FF8040"][color="#006400"][i]// export sorted CfgWeapon mass[/i][/color]
[color="#006400"][i]// fight9[/i][/color]

[color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_data"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_weapons"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_data[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_weapons[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"(getNumber (_x >> 'scope') >= 2)"[/color] [color="#191970"][b]configClasses[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]configFile[/b][/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"CfgWeapons"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#191970"][b]format[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Sorted CfgWeapon Mass<br /><br />Processing %1 Items, Please Wait..."[/color][color="#8B3E2F"][b],[/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_weapons[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]

[color="#191970"][b]for[/b][/color] [color="#7A7A7A"]"_index"[/color] [color="#191970"][b]from[/b][/color] [color="#FF0000"]0[/color] [color="#191970"][b]to[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_weapons[/color] [color="#8B3E2F"][b]-[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]do[/b][/color] [color="#8B3E2F"][b]{[/b][/color]
[color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_config"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_class"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_mass"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_name"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_info"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_config[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#1874CD"]_weapons[/color] [color="#191970"][b]select[/b][/color] [color="#1874CD"]_index[/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_class[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]configName[/b][/color] [color="#1874CD"]_config[/color][color="#8B3E2F"][b];[/b][/color]
[color="#000000"]_name[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getText[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_config[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"displayName"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#000000"]_name[/color] [color="#8B3E2F"][b]=[/b][/color][color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]""[/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b]{[/b][/color][color="#000000"]_name[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"N/A"[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_info[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]if[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#191970"][b]isClass[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_config[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"weaponSlotsInfo"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b])[/b][/color] [color="#191970"][b]then[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#7A7A7A"]"weaponSlotsInfo"[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#7A7A7A"]"itemInfo"[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_mass[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]getNumber[/b][/color] [color="#8B3E2F"][b]([/b][/color][color="#1874CD"]_config[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#1874CD"]_info[/color] [color="#8B3E2F"][b]>[/b][/color][color="#8B3E2F"][b]>[/b][/color] [color="#7A7A7A"]"mass"[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_data[/color] [color="#191970"][b]pushBack[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_mass[/color][color="#8B3E2F"][b],[/b][/color][color="#000000"]_name[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_class[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_data[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#1874CD"]_data[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b][[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]{[/b][/color][color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b]}[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"DESCEND"[/color][color="#8B3E2F"][b]][/b][/color] [color="#191970"][b]call[/b][/color] BIS_fnc_sortBy[color="#8B3E2F"][b];[/b][/color] [color="#006400"][i]//-- Main Branch[/i][/color]
[color="#006400"][i]// _data sort false; //-- DEV Branch[/i][/color]

[color="#191970"][b]private[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"_text"[/color][color="#8B3E2F"][b],[/b][/color][color="#7A7A7A"]"_break"[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_break[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]toString[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#FF0000"]10[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#1874CD"]_text[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#7A7A7A"]"RANK | MASS | NAME | CLASSNAME"[/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]{[/b][/color]
[color="#1874CD"]_text[/color] [color="#8B3E2F"][b]=[/b][/color] [color="#191970"][b]formatText[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"%1%2%3. %4 | %5 | %6"[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_text[/color][color="#8B3E2F"][b],[/b][/color][color="#1874CD"]_break[/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_forEachIndex[/color] [color="#8B3E2F"][b]+[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]0[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]1[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b],[/b][/color][color="#8B3E2F"][b]([/b][/color][color="#000000"]_x[/color] [color="#191970"][b]select[/b][/color] [color="#FF0000"]2[/color][color="#8B3E2F"][b])[/b][/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]
[color="#8B3E2F"][b]}[/b][/color] [color="#191970"][b]forEach[/b][/color] [color="#1874CD"]_data[/color][color="#8B3E2F"][b];[/b][/color]

[color="#191970"][b]copyToClipboard[/b][/color] [color="#191970"][b]str[/b][/color] [color="#1874CD"]_text[/color][color="#8B3E2F"][b];[/b][/color]
[color="#191970"][b]hint[/b][/color] [color="#191970"][b]parseText[/b][/color] [color="#191970"][b]format[/b][/color] [color="#8B3E2F"][b][[/b][/color][color="#7A7A7A"]"Sorted CfgWeapon Mass<br /><br />Completed, %1 Items Copied To Clipboard"[/color][color="#8B3E2F"][b],[/b][/color][color="#191970"][b]count[/b][/color] [color="#1874CD"]_data[/color][color="#8B3E2F"][b]][/b][/color][color="#8B3E2F"][b];[/b][/color]

[/color]

Made with KK's SQF to BBCode Converter

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  

×