Biki Export Scripts: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\{\{( *)Informative( *)\|" to "{{$1Feature$2|$2Informative$2|")
Line 2: Line 2:
= Introduction =
= Introduction =
This page contains all export scripts used to generate data on various pages on this wiki. In order to quickly link to the export script used to generate data on a specific page use  
This page contains all export scripts used to generate data on various pages on this wiki. In order to quickly link to the export script used to generate data on a specific page use  
<pre>{{Informative|Extraction script can be found on the [[Biki Export Scripts#{{PAGENAME}}|Biki Export Scripts]] page.}}</pre> on that specific page.
<pre>{{Feature|Informative|Extraction script can be found on the [[Biki Export Scripts#{{PAGENAME}}|Biki Export Scripts]] page.}}</pre> on that specific page.


= [[Arma 3: CfgFunctions]] =
= [[Arma 3: CfgFunctions]] =

Revision as of 01:01, 7 February 2021

Introduction

This page contains all export scripts used to generate data on various pages on this wiki. In order to quickly link to the export script used to generate data on a specific page use

{{Feature|Informative|Extraction script can be found on the [[Biki Export Scripts#{{PAGENAME}}|Biki Export Scripts]] page.}}

on that specific page.

Arma 3: CfgFunctions

Author: R3vo

private _export = format ["Last updated: {{GVI|arma3|%1}}",productVersion # 2 / 100] + endl + "{| class=""wikitable sortable"" border=""1"" style=""border-collapse:collapse; font-size:100%;"" cellpadding=""0.5em""
! Group
! Category
! Functions";

{ // Config
	private _indexConfig = _forEachIndex;
	private _nameConfig = _x # 0;
	{ // Tags
		private _nameTAG = configName _x;
		private _valueTAG = getText (_x >> "tag");
		if (_valueTAG == "") then { _valueTag = configName _x };
		{ // Categories
			private _nameCategory = configName _x;
			_export = _export + endl + "|-" + endl + "!" + _nameTAG + endl + "!" + _nameCategory + endl + "|";
			private _pathCategory = getText (_x >> "file");
			{ // Functions
				private _prefix = ["BIS_fnc_", "BIN_fnc_"] select (_nameTAG in ["A3_Enoch", "A3_Contact"]);
				_export = _export + endl + ":[[" + _prefix + (configName _x) + "]]";
			} forEach ((_nameConfig >> "CfgFunctions" >> _nameTAG >> _nameCategory) call BIS_fnc_returnChildren);
		} forEach ((_nameConfig >> "CfgFunctions" >> configName _x) call BIS_fnc_returnChildren);
	} forEach ((_nameConfig >> "CfgFunctions") call BIS_fnc_returnChildren);
} foreach [[configFile, "configFile"]];

_export = _export + endl + "|}";
copyToClipboard _export;

Arma 3: CfgMarkerColors

Author: R3vo

private _output = format ["Last updated: {{GVI|arma3|%1}}", (productVersion select 2) / 100] + endl;
_output = _output + "{|class =""wikitable""" + endl + format ["|-%1! %2 !! %3",endl,"Config Name","RGBA"];
{
	private _colour = getArray (_x >> "color") call BIS_fnc_colorConfigToRGBA;
	private _colourName = configName _x;
	_output = _output + format ["%1|-%1|%2 || %3",endl,_colourName,_colour];
} forEach configProperties [configFile >> "CfgMarkerColors"];
_output = _output + endl + "|}";
copyToClipboard _output;

Arma 3: CfgMusic

Author: Killzone_kid

_cfgMusic = []; _cfgMusic pushBack format ["Last updated: {{GVI|arma3|%1}}", (productVersion select 2) / 100]; _cfgMusic pushBack format ["{| class=""wikitable sortable"" width=""100%1""", "%"]; _cfgMusic pushBack format ["! width=""5%1"" |No.", "%"]; _cfgMusic pushBack format ["! width=""35%1"" |Title", "%"]; _cfgMusic pushBack format ["! width=""30%1"" |Class Name", "%"]; _cfgMusic pushBack format ["! width=""15%1"" |Duration", "%"]; _cfgMusic pushBack format ["! width=""15%1"" |DLC", "%"]; _cfgMusic pushBack ""; { private _name = getText (_x >> "name"); private _duration = getNumber (_x >> "duration"); _duration = round _duration; private _minutes = floor (_duration / 60); private _mod = _duration mod 60; private _seconds = _mod / 1; _minutesStr = if (_minutes < 10) then {format ["0%1",_minutes]} else {format ["%1",_minutes]}; _secondsStr = if (_seconds < 10) then {format ["0%1",_seconds]} else {format ["%1",_seconds]}; _duration = format ["%1:%2",_minutesStr,_secondsStr]; private _dlc = if (configSourceMod _x == "") then { "Arma 3"; } else { format ["%1",(modParams [[[configSourceMod]] _x,["name"]]) select 0]; }; //Some work around to make wiki link work if (_dlc isEqualTo "[[Arma 3 Contact (Platform)]]") then { _dlc = "Arma 3 Contact"; }; if (_dlc isEqualTo "[[Arma 3 Tac-Ops]]") then { _dlc = "[[Arma 3 Tac-Ops Mission Pack]]"; }; _cfgMusic pushBack "|-"; _cfgMusic pushBack format ["| %1", _forEachIndex + 1]; _cfgMusic pushBack format ["| %1", if (_name == "") then {"N/A"} else {_name}]; _cfgMusic pushBack format ["| %1", configName _x]; _cfgMusic pushBack format ["| %1", if (_duration == "00:00") then {"N/A"} else {_duration}]; _cfgMusic pushBack format ["| %1", _dlc]; _cfgMusic pushBack ""; } forEach ("isClass _x" configClasses (configFile >> "CfgMusic")); _cfgMusic pushBack "|}"; copyToClipboard (_cfgMusic joinString toString[10]);

↑ Back to spoiler's top

createVehicle/vehicles

Author: Killzone_Kid

private _result = "";
"if (getNumber (_x >> 'scope') > 0) then  
{ 
	_result = _result + '* ' + configName _x + ""\n"";
	for '_i' from 0 to count (_x >> 'AnimationSources') - 1 do
	{
		_animSource = (_x >> 'AnimationSources') select _i;
		_source = getText (_animSource >> 'source');
		if (_source == 'hit') then { _source = 'hit [' + getText (_animSource >> 'hitpoint') + ']' };
		if (_source != '') then { _source = ' => ' + _source };
		_result = _result + ('*# ' + configName _animSource + _source) + ""\n"";
	};
}" configClasses (configFile >> "CfgVehicles");
copyToClipboard _result;
_result;

Arma 3: DLC Restrictions

Author: POLPOX

private _mode = 0 ;//0: personal equipments 1: vehicles

private ["_classes","_data","_lookedModel"] ;
_lookedModel = [] ;
if (_mode == 0) then {
	_classes = ("
		getNumber (_x >> 'scope') == 2 and
		[configName _x] call BIS_fnc_baseWeapon == configName _x and
		getNumber (_x >> 'type') != 65536 and 
		!('UnknownEquipment' in (configName _x call BIS_fnc_itemType))
	" configClasses (configFile >> "CfgWeapons")) +
	("getNumber (_x >> 'scope') == 2" configClasses (configFile >> "CfgGlasses"))	+
	("getNumber (_x >> 'scope') == 2 and configName _x isKindOf 'Bag_Base'" configClasses (configFile >> "CfgVehicles")) ;
} ;
if (_mode == 1) then {
	_classes = ("
		getNumber (_x >> 'scope') == 2 and
		(configName _x isKindOf 'AllVehicles' and
		!(configName _x isKindOf 'Man'))
	" configClasses (configFile >> "CfgVehicles")) ;
} ;
	
_data = _classes apply {
	_class = configName _x ;
	_model = (call {
		if ((getNumber (_x >> "itemInfo" >> "type")) == 801) exitWith {
			getText (_x >> "itemInfo" >> "uniformClass")
		} ;
		_split = (getText (_x >> "model") splitString "\") ;
		if ((count _split >= 2) and {!(".p3d" in toLower (_split#(count _split-1)))}) then {
			_split set [count _split -1,(_split#(count _split-1)) + ".p3d"] ;
		} ;
		(_split joinString "\")
	}) ;
	if !(toLower _model in _lookedModel) then {
		systemChat _class ;
		_obj = createSimpleObject [_model,[0,0,0]] ;
		_dlc = getObjectDLC _obj ;
		deleteVehicle _obj ;
		if (isNil "_dlc") then {
			_lookedModel pushBack toLower _model ;
			_lookedModel pushBack -1 ;
			[_x,-1]
		} else {
			_lookedModel pushBack toLower _model ;
			_lookedModel pushBack _dlc ;
			[_x,_dlc]
		} ;
	} else {
		systemChat ("simple object generate skipped: " + _class) ;
		[_x,_lookedModel#((_lookedModel find (toLower _model))+1)]
	} ;
} ;

#define	PB _return pushBack

_return = [
	'{| class="wikitable sortable"',
	'|-'
] ;

if (_mode == 0) then {
	PB '!Type'
} else {
	PB '!Faction'
} ;

_return = _return + [
	'!classname',
	'!displayName',
	'!Icon',
	'!Restricted?'
] ;


_IDtoDLC = {
	switch _this do {
		case 275700: {"Curator"} ;
		case 288520: {"Kart"} ;
		case 304380: {"Heli"} ;
		case 332350: {"Mark"} ;
		case 395180: {"Expansion"} ;
		case 571710: {"Orange"} ;
		case 601670: {"Jets"} ;
		case 612480: {"Argo"} ;
		case 744950: {"Tacops"} ;
		case 798390: {"Tank"} ;
		case 1021790: {"Enoch"} ;
		default {""} ;
	} ;
} ;

{
	_x params ["_class","_dlc"] ;
	_dlcName = _dlc call _IDtoDLC ;
	PB "|-" ;
	_BGCol = (call {if (_dlcName != "") exitWith {'style="background: #edd;"|'} ; ""}) ;
	if (_mode == 0) then {
		PB ("|" + _BGCol + call {
			if ((configHierarchy (_x#0))#1 == (configFile >> "CfgWeapons")) exitWith {
				#define IKO(typeClass)	(configName (_x select 0) isKindOf [typeClass,configFile >> "CfgWeapons"])
				_type = (configName (_x#0)) call BIS_fnc_itemType ;
				if (IKO("Rifle")) exitWith {"Rifle"} ;
				if (IKO("Pistol")) exitWith {"Pistol"} ;
				if (IKO("Launcher")) exitWith {"Launcher"} ;
				if (_type#1 == "GPS") exitWith {"Terminal"} ;
				if (_type#1 == "UAVTerminal") exitWith {"Terminal"} ;
				if (_type#1 == "AccessoryMuzzle") exitWith {"Muzzle Attachment"} ;
				if (_type#1 == "AccessorySights") exitWith {"Sight"} ;
				if (_type#1 == "AccessoryPointer") exitWith {"Rail Attachment"} ;
				if (_type#1 == "AccessoryBipod") exitWith {"Bipod"} ;
				if (_type#1 == "LaserDesignator") exitWith {"Binocular"} ;
				if (_type#1 == "NVGoggles") exitWith {"NVGs"} ;
				if (_type#1 == "Radio") exitWith {"Communication"} ;
				if (
					_type#1 == "FirstAidKit" or
					_type#1 == "Medikit" or
					_type#1 == "Toolkit" or
					_type#1 == "MineDetector"
				) exitWith {"Item"} ;
				_type#1
			} ;
			if ((configHierarchy (_x#0))#1 == (configFile >> "CfgGlasses")) exitWith {
				"Facewear"
			} ;
			if ((configHierarchy (_x#0))#1 == (configFile >> "CfgVehicles") and configName (_x#0) isKindOf "Bag_Base") exitWith {
				"Backpack"
			} ;
		}) ;
	} else {
		PB ("|" + _BGCol + getText (configfile >> "CfgFactionClasses" >> (getText (_class >> "faction")) >> "displayName")) ;
	} ;
	
	PB ("|" + _BGCol + configName _class) ;
	PB ("|" + _BGCol + getText (_class >> "displayName")) ;
	
	private "_MOD" ;
	if (_mode == 0) then {
		_addon = (configSourceAddonList (_x#0)) ;
		_MOD = configSourceMODList (configFile >> "CfgPatches" >> _addon#0) ;
		if (count _MOD > 0) then {
			_MOD = _MOD#0
		} else {
			_MOD = ""
		} ;
	} ;
	if (_mode == 1) then {
		_MOD = (configSourceMODList (_x#0)) ;
		if (count _MOD > 0) then {
			_MOD = _MOD#0
		} else {
			_MOD = ""
		} ;
	} ;
	
	PB ("|" + _BGCol + (["",format ["{{Icon|%1|25}}",toLower _MOD]] select (_MOD != ""))) ;
	
	if (_dlcName == "") then {
		PB ("|" + "No") ;
	} else {
		_dlcDisplayName = getText (configFile >> "CfgMODs" >> _dlcName >> "nameShort") ;
		if (_dlcName == "enoch") then {
			PB ("|" + _BGCol + "Contact") ;
		} else {
			PB ("|" + _BGCol + _dlcDisplayName) ;
		} ;
	} ;
} forEach _data ; 

PB "|}" ;
copyToClipboard (_return joinString endl) ;
↑ Back to spoiler's top

inputAction/actions

Author: POLPOX

_r = [] ;
{
	_r pushBack [getText (_x >> "name"),[]] ;
	_index = _forEachIndex ;
	{
		private _actionName = actionName _x ;
		(_r#_index#1) pushBack [_x,_actionName] ;
	} forEach getArray (_x >> "group") ;
} forEach ("true" configClasses (configFile >> "UserActionGroups")) ;

_rFinal = [
	'{| class="sortable wikitable"'
] ;

_presets = ("configName _x != 'Empty'" configClasses (configFile >> "CfgDefaultKeysPresets")) ;
_str = '! Type !! actionName !! Name' ;

{
	_str = _str + " !! " + getText (_x >> "displayName") ;
	if (getNumber (_x >> "default") == 1) then {
		_str = _str + "<br/>(Default)" ;
	} ;
} forEach _presets ;


_rFinal pushBack format ['! colspan="3"| Action information !! colspan="%1"| Presets',count _presets] ;
_rFinal pushBack "|-" ;
_rFinal pushBack _str ;

{
	_type = _x#0 ;
	{
		_rFinal pushBack "|-" ;
		_x params ["_actionName","_name"/*,"_tooltip"*/] ;
		if (_name isEqualTo "") then {
			_name = "{{n/a}}" ;
		} ;
		_str = format ["| %1 || <tt>%2</tt> || %3 ",_type,_actionName,_name] ;
		{
			_keys = getArray (_x >> "Mappings" >> _actionName) ;
			if (count _keys != 0) then {
				_keys = _keys apply {
					call {
						if (typeName _x == "STRING") exitWith {
							keyName call compile _x ;
						} ;
						if (typeName _x == "ARRAY") exitWith {
							_r = [] ;
							{
								if (typeName _x == "STRING") then {
									_r pushBack ((keyName call compile _x) splitString """")#0 ;
								} ;
								_r pushBack ((keyName _x) splitString """")#0 ;
							} forEach _x ;
							_r = (_r joinString "+") ;
							_r
						} ;
						keyName _x
					} ;
				} ;
				_str = _str + format ["|| %1 ",(_keys joinString ", " splitString """")#0] ;
			} else {
				_str = _str + "|| " ;
			} ;
		} forEach _presets ;
		_rFinal pushBack _str ;
	} forEach (_x#1) ;
} forEach _r ;

_rFinal pushBack "|}" ;

copyToClipboard (_rFinal joinString endl) ;
↑ Back to spoiler's top

Modules

Author: R3vo

private _version = format ["Last updated: {{GVI|arma3|%1}}", productVersion # 2 / 100];
private _counter = 0;
private _export = _version + endl + "{| class=""wikitable""" + endl + "! Module Name !! Category !! Addon !! Function !! Description" + endl + "|-" + endl;
private _modules = "(configName inheritsFrom _x) == 'Module_F'" configClasses (configFile >> "CfgVehicles");
{
	if ((getNumber (_x >> "scope") > 1)) then
	{
		private _name = getText (_x >> "displayName");
		private _cat = getText (_x >> "category");
		private _mod = configSourceMod _x;
		private _fnc = getText (_x >> "function");
		if !(_fnc isEqualTo "") then
		{
			_fnc = _fnc select [7];
			_fnc = "[[BIS_fnc" + _fnc + "]]";
		};
		private _desc = getText (_x >> "ModuleDescription" >> "Description");
		if (_desc isEqualTo "") then {_desc = ""};
		if (_mod == "") then {_mod = "A3"};
		private _modName = modParams [_mod,["name"]];
		_modName = _modName select 0;
		_cat = getText (configFile >> "CfgFactionClasses" >> _cat >> "displayName");
		if (_cat isEqualTo "") then {_cat = "Others"};

		_export = _export + "| " + _name + endl + "|| " + _cat + endl + "|| " + _modName + endl + "|| " + _fnc + endl + "|| " + _desc + endl + "|-" + endl;
	};
	_counter = _counter + 1;
} forEach _modules;

_export = _export + "|}" + endl + format ["Total number of modules: %1", _counter];
copyToClipboard _export;
↑ Back to spoiler's top