Last active
May 6, 2021 07:38
-
-
Save indig0fox/798dcf1f53e8bbdcda867d175af31ba6 to your computer and use it in GitHub Desktop.
Arma 3 Asset Table: Opens a UI table that shows details about all vehicles within 500m of the player.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//description.ext or controls.hpp | |
#include "\a3\ui_f\hpp\defineCommon.inc" | |
#define CT_CONTROLS_TABLE 19 | |
class TestDisplay | |
{ | |
idd = -1; | |
class controls | |
{ | |
class _CT_CONTROLSTABLE | |
{ | |
idc = 107; | |
onLoad = "_this execVM 'CT_CONTROLS_TABLE.sqf'"; | |
x = 0.108125 * safezoneW + safezoneX; | |
y = 0.115 * safezoneH + safezoneY; | |
w = 55 * GUI_GRID_W; | |
h = 0.759 * safezoneH; | |
type = CT_CONTROLS_TABLE; | |
style = SL_TEXTURES; | |
lineSpacing = 0; | |
rowHeight = 1 * GUI_GRID_H; | |
headerHeight = 1 * GUI_GRID_H; | |
firstIDC = 42000; | |
lastIDC = 44999; | |
// Colours which are used for animation (i.e. change of colour) of the selected line. | |
selectedRowColorFrom[] = {0.7, 0.85, 1, 0.25}; | |
selectedRowColorTo[] = {0.7, 0.85, 1, 0.5}; | |
// Length of the animation cycle in seconds. | |
selectedRowAnimLength = 1.2; | |
class VScrollBar: ScrollBar | |
{ | |
width = 0.021; | |
autoScrollEnabled = 0; | |
autoScrollDelay = 1; | |
autoScrollRewind = 1; | |
autoScrollSpeed = 1; | |
}; | |
class HScrollBar: ScrollBar | |
{ | |
height = 0.028; | |
}; | |
// Template for selectable rows | |
class RowTemplate | |
{ | |
class RowBackground | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 0; | |
columnW = 55 * GUI_GRID_W; | |
controlOffsetY = 0; | |
controlH = 1 * GUI_GRID_H; | |
}; | |
class Column1 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 0; | |
columnW = 6 * GUI_GRID_W; | |
controlOffsetY = 0; | |
controlH = 1 * GUI_GRID_H; | |
}; | |
class Column2 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 6 * GUI_GRID_W; | |
columnW = 8 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column3 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 14 * GUI_GRID_W; | |
columnW = 5 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column4 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 19 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column5 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 21 * GUI_GRID_W; | |
columnW = 12 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
size = 0.6 * GUI_GRID_H; | |
}; | |
class Column6 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 33 * GUI_GRID_W; | |
columnW = 16 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
size = 0.6 * GUI_GRID_H; | |
}; | |
class Column7 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 48 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column8 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 50 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column9 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 52 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
}; | |
// Template for headers (unlike rows, cannot be selected) | |
class HeaderTemplate | |
{ | |
class HeaderBackground | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 0; | |
columnW = 55 * GUI_GRID_W; | |
controlOffsetY = 0; | |
}; | |
class Column1 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 0; | |
columnW = 6 * GUI_GRID_W; | |
controlOffsetY = 0; | |
controlH = 1 * GUI_GRID_H; | |
}; | |
class Column2 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 6 * GUI_GRID_W; | |
columnW = 8 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column3 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 14 * GUI_GRID_W; | |
columnW = 5 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column4 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 19 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column5 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 21 * GUI_GRID_W; | |
columnW = 12 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
size = 0.6 * GUI_GRID_H; | |
}; | |
class Column6 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 33 * GUI_GRID_W; | |
columnW = 16 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
size = 0.6 * GUI_GRID_H; | |
}; | |
class Column7 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 48 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column8 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 50 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
class Column9 | |
{ | |
controlBaseClassPath[] = {"RscText"}; | |
columnX = 52 * GUI_GRID_W; | |
columnW = 2 * GUI_GRID_W; | |
controlOffsetY = 0.1 * GUI_GRID_H; | |
}; | |
}; | |
}; | |
}; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
disableSerialization; | |
params ["_ctrl"]; | |
ctAddHeader _ctrl params ["_ind", "_header"]; | |
_header params ["_ctrlHeaderBackground", | |
"_ctrlHeaderColumn1", | |
"_ctrlHeaderColumn2", | |
"_ctrlHeaderColumn3", | |
"_ctrlHeaderColumn4", | |
"_ctrlHeaderColumn5", | |
"_ctrlHeaderColumn6", | |
"_ctrlHeaderColumn7", | |
"_ctrlHeaderColumn8", | |
"_ctrlHeaderColumn9", | |
"_ctrlHeaderColumn10" | |
]; | |
_ctrlHeaderBackground ctrlSetBackgroundColor [0.8,0.5,0.0,1]; | |
_ctrlHeaderColumn1 ctrlSetText "DisplayName"; | |
_ctrlHeaderColumn2 ctrlSetText "Type"; | |
_ctrlHeaderColumn3 ctrlSetText "Mod"; | |
_ctrlHeaderColumn4 ctrlSetText "Lock"; | |
_ctrlHeaderColumn5 ctrlSetText "Weapons"; | |
_ctrlHeaderColumn6 ctrlSetText "Ammo"; | |
_ctrlHeaderColumn7 ctrlSetText "Seats"; | |
_ctrlHeaderColumn8 ctrlSetText "Crew"; | |
_ctrlHeaderColumn9 ctrlSetText "Pass"; | |
// _ctrlHeaderColumn10 ctrlSetText "cargoSeats"; | |
// Get asset info | |
_output = []; | |
{ | |
if ((_x call BIS_fnc_objectType select 0) in "Vehicle") then { | |
private[ | |
"_configName", | |
"_class", | |
"_dispName", | |
"_objType", | |
"_locked", | |
"_init", | |
"_mod", | |
"_author", | |
"_cat", | |
"_fac", | |
"_side", | |
"_dlc", | |
"_vc", | |
"_weapons", | |
"_ammo", | |
"_cargoWep", | |
"_cargoWepAcc", | |
"_cargoMag", | |
"_cargoItem", | |
"_cargoBackpack", | |
"_totalSeats", | |
"_crewSeats", | |
"_cargoSeats", | |
"_nonFFVcargoSeats", | |
"_ffvCargoSeats" | |
]; | |
_configName = configOf _x; | |
_class = configName _configName; | |
_dispName = getText(_configName >> 'displayName'); | |
_objType = (_x call BIS_fnc_objectType) select 1; | |
_locked = ""; | |
switch (locked _x) do { | |
case 3: {_locked = "Yes"}; | |
default {_locked = "No"}; | |
}; | |
_init = [_configName >> "EventHandlers", "init", ""] call BIS_fnc_returnConfigEntry; | |
_mod = configSourceMod _configName; | |
_author = getText(_configName >> 'author'); | |
_cat = getText(_configName >> 'category'); | |
_fac = getText(_configName >> 'faction'); | |
_side = [getNumber(_configName >> 'side')] call BIS_fnc_sideName; | |
_dlc = getText(_configName >> 'dlc'); | |
_vc = getText(_configName >> 'vehicleClass'); | |
_weapons = []; | |
{ | |
_disp = getText(configFile >> "CfgWeapons" >> _x >> "displayName"); | |
if (_disp != "Horn") then { | |
_weapons pushBack getText(configFile >> "CfgWeapons" >> _x >> "displayName"); | |
}; | |
} forEach weapons _x; | |
_ammo = []; | |
{ | |
_ammo pushBack format["%1 (%2) x%3", getText(configFile >> "CfgMagazines" >> (_x # 0 # 0) >> "displayName"), _x # 0 # 1,_x # 1]; | |
} forEach (magazinesAmmo _x call BIS_fnc_consolidateArray); | |
_cargoWep = weaponCargo _x; | |
_cargoWepAcc = weaponsItemsCargo _x; | |
_cargoMag = magazineCargo _x; | |
_cargoItem = itemCargo _x; | |
_cargoBackpack = backpackCargo _x; | |
_totalSeats = [configName _configName, true] call BIS_fnc_crewCount; // Number of total seats: crew + non-FFV cargo/passengers + FFV cargo/passengers | |
_crewSeats = [configName _configName, false] call BIS_fnc_crewCount; // Number of crew seats only | |
_cargoSeats = _totalSeats - _crewSeats; // Number of total cargo/passenger seats: non-FFV + FFV | |
_nonFFVcargoSeats = getNumber(_configName >> "transportSoldier"); // Number of non-FFV cargo seats only | |
_ffvCargoSeats = _cargoSeats - _nonFFVcargoSeats; // Number of FFV cargo seats only | |
_output pushBack [ | |
_dispName, | |
_vc, | |
_mod, | |
_locked, | |
_weapons, | |
_ammo, | |
_totalSeats, | |
_crewSeats, | |
_cargoSeats | |
]; | |
}; | |
} | |
forEach (getPos player nearEntities 500); | |
_output = [_output, [], {_x # 0}] call BIS_fnc_sortBy; | |
// output ForEach | |
{ | |
ctAddRow _ctrl params ["_ind", "_row"]; | |
_row params ["_ctrlBackground", "_ctrlColumn1", "_ctrlColumn2", "_ctrlColumn3", "_ctrlColumn4", "_ctrlColumn5", "_ctrlColumn6","_ctrlColumn7","_ctrlColumn8", "_ctrlColumn9", "_ctrlColumn10", "_ctrlColumn11", "_ctrlColumn12", "_ctrlColumn13"]; | |
_ctrlBackground ctrlSetBackgroundColor [0,0,0,0.8]; | |
_ctrlColumn1 ctrlSetText format["%1",_x # 0]; | |
_ctrlColumn2 ctrlSetText format["%1",_x # 1]; | |
_ctrlColumn3 ctrlSetText format["%1",_x # 2]; | |
_ctrlColumn4 ctrlSetText format["%1",_x # 3]; | |
if (count (_x # 4) != 0) then {_ctrlColumn5 ctrlSetText "Weapons vvv"} else {_ctrlColumn5 ctrlSetText "Unarmed"}; | |
if (count (_x # 5) != 0) then {_ctrlColumn6 ctrlSetText "Ammo vvv"} else {_ctrlColumn6 ctrlSetText "No Ammo"}; | |
_ctrlColumn7 ctrlSetText format["%1",_x # 6]; | |
_ctrlColumn8 ctrlSetText format["%1",_x # 7]; | |
_ctrlColumn9 ctrlSetText format["%1",_x # 8]; | |
// _ctrlColumn10 ctrlSetText format["%1",_x # 9]; | |
// _ctrlColumn11 ctrlSetText str(_x # 10); | |
// _ctrlColumn12 ctrlSetText str(_x # 11); | |
// _ctrlColumn13 ctrlSetText str(_x # 12); | |
private _exRow = 1; // extra rows | |
if (count (_x # 4) > count (_x # 5)) then {_exRow = count (_x # 4)} else {_exRow = count (_x # 5)}; | |
for "_i" from 0 to (_exRow - 1) do { | |
ctAddRow _ctrl params ["_ind", "_row"]; | |
_row params ["_ctrlBackground", "_ctrlColumn1", "_ctrlColumn2", "_ctrlColumn3", "_ctrlColumn4", "_ctrlColumn5", "_ctrlColumn6","_ctrlColumn7","_ctrlColumn8", "_ctrlColumn9", "_ctrlColumn10", "_ctrlColumn11", "_ctrlColumn12", "_ctrlColumn13"]; | |
_ctrlBackground ctrlSetBackgroundColor [0.1,0.1,0.1,0.8]; | |
if (count (_x # 4) != 0 || (count (_x # 4) - 1 < _i)) then { | |
_ctrlColumn5 ctrlSetText format["%1", _x # 4 # _i]; | |
} else { | |
_ctrlColumn5 ctrlSetText str text ""; | |
}; | |
if (count (_x # 5) != 0) then { | |
_ctrlColumn6 ctrlSetText format["%1", _x # 5 # _i]; | |
} else { | |
_ctrlColumn6 ctrlSetText str text ""; | |
}; | |
}; | |
} forEach _output; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
findDisplay 46 createDisplay "TestDisplay"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment