7erra/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
(bis_fnc_arsenal variables)
 
(24 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{SideTOC}}
=== Variables ===
== Example ==
This is a list of all the variables that are used by the Virtual Arsenal.
{{GVI|arma3|1.66}}
{| class="wikitable"
You can check some of the grid systems on an interactive test menu ingame:
# Open [[Eden Editor]]
# Open debug console (Tools > Debug Console)
# Execute this code: <code>[[findDisplay]] 313 [[createDisplay]] "RscTestGrids";</code>
 
A menu where you can see how all grid systems react to specific resolutions, aspect ratios and interface sizes.
 
[[File:a3_GUI_grids.png|320px]]
* Hovering over each grid will show a detailed description in tooltip.
* Data for each grid shows the current size and max number of grids horizontally and vertically. Useful for making sure your menu proportions will work in all combinations.
* Click COPY TO CLIPBOARD button to copy a code with an example that can be used directly in [[Config.cpp]] or [[Description.ext]].
 
== Grids ==
=== Absolute ===
{{GVI|ofp|1.00}}
The absolute grid refers to a 4:3 screen with UI size "Very Large". It is the oldest of the three grids (absolute, safeZone and pixelGrid). Because of this it is never advisable to use it. Config example:
<syntaxhighlight lang="cpp">class TextAbsolute: RscText
{
text = "Absolute grid";
x = 0;
y = 0.5;
w = 0.15;
h = 0.028;
};
</syntaxhighlight>
 
=== [[SafeZone]] ===
<!--- TODO?: new safezone picture with safeZoneWAbs and safeZoneHAbs --->
{{GVI|arma2|1.00}}
[[File:UI 12-3.jpg|thumb|safeZone values and their position on a triple screen setup.|500px]]
To keep the dialog on screen the safeZone values were introduced. For more information there is [[SafeZone|a dedicated page for the safeZone system]]. Here is a quick overview over the six commands:
{| class="wikitable" style="min-width: 20em"
|-
|-
! Command !! Explanation
! colspan=3 | [[missionNamespace]]
|-
|-
| [[safeZoneX]] || The left edge of the screen on SINGLE monitor settings.
! Variable !! Data Type !! Explanation
|-
|-
| [[safeZoneXAbs]] || The left edge of the screen on MULTIPLE monitors (Triple Head, three screens).
| BIS_fnc_arsenal_data || [[Array]] of arrays of [[String|strings]] || All available items that can be accessed in the Arsenal (not the actual content!). Format:<br>
 
{| class="wikitable"
|-
|-
| [[safeZoneY]] || The top edge of the screen.
! Index !! Content
|-
|-
| [[safeZoneW]] || The width of of the screen in a SINGLE monitor setup (or the center one in case of triple head).
| 0 || Primary Weapons
|-
|-
| [[safeZoneWAbs]] || The width of a triple head setup. In case of a single monitor this is equal to safeZoneW.
| 1 || Secondary Weapons
|-
|-
| [[safeZoneH]] || The height of the screen
| 2 || Handguns
|}
 
<syntaxhighlight lang="cpp">
//--- Text box which covers the top right quarter of the (center) screen
class TextboxTopRightQuarter: RscText
{
x = safezoneX + 0.5 * safeZoneW;
y = safezoneY;
w = 0.5 * safezoneW;
h = 0.5 * safezoneH;
};
//--- Textbox which covers the entire screen on a triple head setup
class TextboxFullTripleScreen: RscText
{
x = safeZoneXAbs;
y = safeZoneY;
w = safeZoneWAbs;
h = safeZoneH;
};
</syntaxhighlight>
 
=== GUI_GRID ===
{{GVI|arma3|0.50}}
[[File:GUI GRID defines.png|thumb|GUI_GRIDs on "Very Large", "Normal" and "Very Small" (from top to bottom) on a 1920x1080 (16:9) screen. Not shown here are the pictures for the UI sizes "Small" and "Large".|500px]]
The GUI_GRID is based on the safeZone grid and is used by the majority of the game's dialogs. The additional functionality is the possibility to stay on screen even with different user settings such as aspect ratio or UI scale. It also helps to keep a uniform style between dialogs. If you are using the base classes starting with "Rsc" then it is advisable to use this grid as some attributes (eg. fonts) will only scale correctly with this grid. The defines for use in configs and scripts can be accessed by adding this line to your config:
<syntaxhighlight lang="cpp">#include "\a3\ui_f\hpp\definecommongrids.inc"</syntaxhighlight>
The following table will list the most commonly used grids which are defined in said file. To use them add the appropiate suffix _X, _Y, _W or _H to the variable name, eg GUI_GRID includes GUI_GRID_X, GUI_GRID_Y, GUI_GRID_W and GUI_GRID_H. The second and third column refer to where the dialog will originate from on other UI sizes.
 
{| class="wikitable"
|-
|-
! #define !! Horizontal !! Vertical !! Notes
| 3 || Uniforms
|-
|-
| GUI_GRID || Left || Bottom || Example: Escape menu (RscDisplayInterrupt)
| 4 || Vests
|-
|-
| GUI_GRID_CENTER || Center || Middle || Example: RscDisplayTeamSwitch
| 5 || Backpacks
|-
|-
| GUI_GRID_TOPCENTER || Center || Top ||  
| 6 || Headgear
|-
|-
| GUI_GRID_BOTTOMCENTER || Center || Bottom || Example: Revive UI
| 7 || Goggles
|-
|-
| GUI_GRID_CENTER_BOTTOM || Center || Bottom || Same as GUI_GRID_BOTTOMCENTER
| 8 || NVGs
|-
|-
| GUI_GRID_TOPLEFT || Left || Top || Diary (the top left part of the map)
| 9 || Binoculars
|}
 
The GUI_GRID divides the screen into 40 parts on the horizontal axis and into 25 vertically. Therefore no content should have negative x or y values nor should it exceed a width of 40 or a height of 25. Using a height of 25 or width of 40 is not the same as using screen height or width because the GUI_GRID will get smaller with smaller UI sizes as it should be. Examples:
<syntaxhighlight lang="cpp">
//--- Okay, will use entire available space:
x = GUI_GRID_CENTER_X + 0 * GUI_GRID_CENTER_W;
y = GUI_GRID_CENTER_Y + 0 * GUI_GRID_CENTER_H;
w = 40 * GUI_GRID_CENTER_W;
h = 25 * GUI_GRID_CENTER_H;
</syntaxhighlight>
<syntaxhighlight lang="cpp">
//--- NOT okay:
x = GUI_GRID_CENTER_X - 1 * GUI_GRID_CENTER_W;
y = GUI_GRID_CENTER_Y - 1 * GUI_GRID_CENTER_H;
w = 50 * GUI_GRID_CENTER_W;
h = 30 * GUI_GRID_CENTER_H;
</syntaxhighlight>
The second example will dissapear on certain settings on the left and top edge as well as exceed the screen's width and height.
 
Here is a copy paste example:
<syntaxhighlight lang="cpp">#include "\a3\ui_f\hpp\definecommongrids.inc"
#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)
class RscStructuredText
{
deletable = 0;
fade = 0;
access = 0;
type = CT_STRUCTURED_TEXT;
idc = -1;
style = ST_LEFT;
colorText[] = {1,1,1,1};
class Attributes
{
font = "RobotoCondensed";
color = "#ffffff";
colorLink = "#D09B43";
align = "left";
shadow = 1;
};
x = 0;
y = 0;
h = 0;
w = 0;
text = "";
size = GUI_TEXT_SIZE_MEDIUM;
shadow = 1;
};
class MyDialog
{
idd = -1;
class controls
{
class TextGUIGRID: RscStructuredText
{
text = "Text on the left bottom";
x = GUI_GRID_X + 0 * GUI_GRID_W;
y = GUI_GRID_Y + 24 * GUI_GRID_H;
w = 40 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
};
class TextGUIGRIDCENTER: RscStructuredText
{
text = "<t align='center'>Text in the middle</t>";
x = GUI_GRID_CENTER_X + 0 * GUI_GRID_CENTER_W;
y = GUI_GRID_CENTER_Y + 12.5 * GUI_GRID_CENTER_H;
w = 40 * GUI_GRID_CENTER_W;
h = 1 * GUI_GRID_CENTER_H;
};
class TextGUIGRIDTOPCENTER: RscStructuredText
{
text = "<t align='center'>Text in the top center</t>";
x = GUI_GRID_TOPCENTER_X + 0 * GUI_GRID_TOPCENTER_W;
y = GUI_GRID_TOPCENTER_Y + 0 * GUI_GRID_TOPCENTER_H;
w = 40 * GUI_GRID_TOPCENTER_W;
h = 1 * GUI_GRID_TOPCENTER_H;
};
class TextGUIGRIDBOTTOMCENTER: RscStructuredText
{
text = "<t align='center'>Text bottom center</t>";
x = GUI_GRID_BOTTOMCENTER_X + 0 * GUI_GRID_BOTTOMCENTER_W;
y = GUI_GRID_BOTTOMCENTER_Y + 24 * GUI_GRID_BOTTOMCENTER_H;
w = 40 * GUI_GRID_BOTTOMCENTER_W;
h = 1 * GUI_GRID_BOTTOMCENTER_H;
};
class TextGUIGRIDTOPLEFT: TextGUIGRID
{
text = "Text on the left top";
x = GUI_GRID_TOPLEFT_X + 0 * GUI_GRID_TOPLEFT_W;
y = GUI_GRID_TOPLEFT_Y + 0 * GUI_GRID_TOPLEFT_H;
// w and h are inherited from TextGUIGRID
// GUI_GRID_name_W and GUI_GRID_name_H are the same for every define
};
};
};
</syntaxhighlight>
 
=== [[Pixel Grid System|Pixel Grid]] ===
{{GVI|arma3|1.60}} {{GVI|arma3|1.62}}
The pixel grid system was introduced to resolve issues with UI elements which appeared not as they should be because of the fact that the computer can't draw inbetween pixels. For a more indepth explanation of the grid go to the [[Pixel Grid System|dedicated BIKI page]]. The base controls from which to inherit from usually start with ctrl, eg. ctrlPicture, ctrlStrucuturedText, etc.. Mixing controls with different grids on the same dialog might lead to undesired visuals.
 
==== Commands ====
{| class="wikitable"
|-
! Command !! Explanation
|-
|-
| [[pixelW]] || Width of one pixel. On displays with too fine resolution (e.g., 4K), it can get too small for practical use.
| 10 || Maps
|-
|-
| [[pixelH]] || Height of one pixel. On displays with too fine resolution (e.g., 4K), it can get too small for practical use.
| 11 || GPS
|-
|-
| [[pixelGrid]] || Multiplier based on resolution, interface size and some config values. It can be divided by up to 4 and still be a whole number. Due to this rounding, some interface sizes may use the same value.
| 12 || Radio
|-
|-
| [[pixelGridBase]] || Multiplier only based on the screen resolution.
| 13 || Compass
|-
|-
| [[pixelGridNoUIScale]] || Similar to pixelGrid, but affected only by resolution, not interface size. Usually used to keep some important elements, e.g., spotlight buttons in the main menu.
| 14 || Watch
|}
 
==== Includes ====
<syntaxhighlight lang="cpp">#include "\a3\3DEN\UI\macros.inc"
#include "\a3\3DEN\UI\macroexecs.inc"</syntaxhighlight>
{| class="wikitable"
|-
|-
! #define !! Explanation
| 15 || Face (empty)
|-
|-
| GRID_W || Width of one grid
| 16 || Voice (empty)
|-
|-
| GRID_H || Height of one grid
| 17 || Insignia (empty)
|-
|-
| CENTER_X || Vertical screen center
| 18 || Optic attachments (empty)
|-
|-
| CENTER_Y || Horizontal screen center
| 19 || Side attachments (empty)
|}
 
==== Examples ====
<syntaxhighlight lang="cpp">
#include "\a3\3DEN\UI\macros.inc"
#include "\a3\3DEN\UI\macroexecs.inc"
class ctrlDefaultText: ctrlDefault
{
sizeEx = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
font = "RobotoCondensedLight";
shadow = 1;
};
class ctrlStructuredText: ctrlDefaultText
{
type = CT_STRUCTURED_TEXT;
colorBackground[] = {0,0,0,0};
size = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
text = "";
class Attributes
{
align = "left";
color = "#ffffff";
colorLink = "";
size = 1;
font = "RobotoCondensedLight";
};
onCanDestroy = "";
onDestroy = "";
};
class MyPixelGridDialog
{
idd = -1;
class controls
{
class TextLeftTop: ctrlStructuredText
{
text = "Left top";
x = safeZoneX + 0 * GRID_W;
y = safeZoneY + 0 * GRID_H;
w = 50 * GRID_W;
h = 5 * GRID_H;
colorBackground[] = {1,0,0,1};
};
class TextCenterMiddle: TextLeftTop
{
text = "Center middle";
x = CENTER_X - 25 * GRID_W;
y = CENTER_Y - 2.5 * GRID_H;
};
class TextRightBottom: TextLeftTop
{
text = "Left bottom";
x = safeZoneX + safeZoneW - 50 * GRID_W;
y = safeZoneY + safeZoneH - 5 * GRID_H;
};
};
};
</syntaxhighlight>
 
== The size/sizeEx attribute ==
{{Informative|'''sizeEx''' and '''size''' both have the same functionality. Some controls use the '''size''' property, others '''sizeEx'''.}}
Some controls make use of the {{Inline code|size}} or {{Inline code|sizeEx}} attribute. These attributes set the fontsize of the control. They expect a number in the format of UI coordinates, therefore you should use the same coordinates as the one you used for the {{Inline code|h}} attribute, eg:
<syntaxhighlight lang="cpp">class TextControl: RscText
{
text = "Large text";
x = GUI_GRID_CENTER_X + 1 * GUI_GRID_CENTER_W;
y = GUI_GRID_CENTER_Y + 0 * GUI_GRID_CENTER_H;
w = 23 * GUI_GRID_CENTER_W;
h = 1 * GUI_GRID_CENTER_H;
sizeEx = 2 * GUI_GRID_CENTER_H;
};
</syntaxhighlight>
 
You can also use the following defines for GUI_GRIDs:
<syntaxhighlight lang="cpp">#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)
</syntaxhighlight>
 
 
And for the pixelGrid:
<syntaxhighlight lang="cpp">class TextControl: ctrlStructuredText
{
text = "Large text";
x = CENTER_X - 20 * GRID_W;
y = CENTER_Y - 5 * GRID_H;
w = 40 * GRID_W;
h = 10 * GRID_H;
size = 10 * GRID_H;
};
</syntaxhighlight>
 
With the defines from {{Inline code|macroexecs.inc}} and {{Inline code|macros.inc}}:
{{AnswerMe|I didn't really understand the macros from a3\3den\ui\macros.inc so if someone could add that info, go ahead.}}
<syntaxhighlight lang="cpp">class TextControl: RscText
{
text = "Large text";
x = CENTER_X - 20 * GRID_W;
y = CENTER_Y - 5 * GRID_H;
w = 40 * GRID_W;
h = 10 * GRID_H;
sizeEx = SIZEEX_PURISTA(SIZE_M); // A macro used to easily set the font size according to some predefined size values and a coefficient. The macro gets the size nearest to the one which was inputted.
};
</syntaxhighlight>
 
List of available pixelGrid font sizes:
<!--- Yes, I just spent an hour trying to get the table to look good. Yes I know the left and right table are still connected. No, I dont know how to fix it --->
{| class="wikitable"
|-
|-
! colspan="2"| sizeEx ||rowspan="7" style="background-color:#ffffff;"  | ||colspan="2"| size
| 20 || Muzzle attachments (empty)
|-
|-
! #define !! Value || #define || Value
| 21 || Compatible magazines (empty)
|-
|-
| SIZEEX_XS || 3.0 || SIZE_XS || 3.5
| 22 || Grenades
|-
|-
| SIZEEX_S || 4.0 || SIZE_S || 4
| 23 || Placeables
|-
|-
| SIZEEX_M || 4.5 || SIZE_M || 5
| 24 || Miscellaneous
|-
|-
| SIZEEX_L || 5.0 || SIZE_L || 5
| 25 || Bipod attachments (empty)
|-
|-
| SIZEEX_XL || 6.0 || SIZE_XL || 6
| 26 || All magazines
|}
 
|}
|}
[[Category: Dialogs|GUI Coordinates]]

Latest revision as of 01:11, 6 September 2021

Variables

This is a list of all the variables that are used by the Virtual Arsenal.

missionNamespace
Variable Data Type Explanation
BIS_fnc_arsenal_data Array of arrays of strings All available items that can be accessed in the Arsenal (not the actual content!). Format:
Index Content
0 Primary Weapons
1 Secondary Weapons
2 Handguns
3 Uniforms
4 Vests
5 Backpacks
6 Headgear
7 Goggles
8 NVGs
9 Binoculars
10 Maps
11 GPS
12 Radio
13 Compass
14 Watch
15 Face (empty)
16 Voice (empty)
17 Insignia (empty)
18 Optic attachments (empty)
19 Side attachments (empty)
20 Muzzle attachments (empty)
21 Compatible magazines (empty)
22 Grenades
23 Placeables
24 Miscellaneous
25 Bipod attachments (empty)
26 All magazines