CfgWeapons – Take On Helicopters Talk

From Bohemia Interactive Community
Revision as of 16:31, 27 October 2011 by Str (talk | contribs) (Created page with "== Export == For export, use following code: <pre>startloadingscreen [""]; _types = [ 0, "Default", 1, "Rifle", 2, "Handgun", 4096, "Item", 65536, "Mounted" ]; _cfg = c...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Export

For export, use following code:

startloadingscreen [""];

_types = [
	0,	"Default",
	1,	"Rifle",
	2,	"Handgun",
	4096,	"Item",
	65536,	"Mounted"
];

_cfg = configfile >> "cfgWeapons";
_cfgCount = count _cfg - 1;
_export = "";
for "_c" from 0 to _cfgCount do {
	_class = _cfg select _c;
	if (isclass _class) then {

		_scope = getnumber (_class >> "scope");
		_displayName = gettext (_class >> "displayName");
		if (_scope > 0 && _displayName != "") then {
			_className = configname _class;
			_type = getnumber (_class >> "type");
			_typeId = _types find _type;
			if (_typeId < 0) then {_typeId = 0};
			_type = _types select (_typeId + 1);
			_magazines = getarray (_class >> "magazines");
			_magazinesExport = "";
			{
				_magazinesExport = _magazinesExport + format ["
* ""%1""
",_x];
			} foreach _magazines;

			_export = _export + format [
"|-
|
===%1===
| %2
| %3
| %4
",
				_className,
				_displayName,
				_type,
				_magazinesExport
			];

		};
	};
	progressloadingscreen (_c / _cfgCount);
};

copytoclipboard _export;

endloadingscreen;