Arma: GUI Configuration
Feel free to make changes though, even if it currently resides in Manny's personal namespace.
-- Manny 15:49, 6 May 2007 (CEST)Introduction
Dialogs are one way to provide custom graphical user interface in your missions and allow interaction with the player aswell as they are able to run code. They are defined as classes in the description.ext file.
Notice: If you change your description.ext file while the mission is still open in the editor, you will have to restart the editor and load the mission again so the changes actually take effect.
Dialogs
Dialogs are parent containers for the actual controls it contains. Their definition contains several properties on the controls it contains, how the dialog can be addressed, and whether or not the player is able to continue regular movement while the dialog is shown.
They can be defined in the description.ext file or externalized to seperate hpp-files, which are included in the description.ext file using the #include preprocessor directive. The latter method is generally a good idea to split a large description.ext file into several small chunks in order to keep track of what's where.
Most often, controls of a dialog are defined within the definition of the dialog itself, though it's a good practice to generalize common controls in a base definition in the global scope. See best practice for details. For simplicity we won't apply this practice in the following code examples.
Properties | ||
---|---|---|
Name | Type | Remark |
idd | integer | the unique ID number of this dialog. can be -1 if you don't require access to the dialog itself from within a script. |
movingEnable | boolean | sets whether or not the player is hindered from aiming or moving while the dialog is open. |
controlsBackground | array | contains class names of all background controls associated to this dialog. |
controls | array | contains class names of all foreground controls associated to this dialog. |
objects | array |
Example of a dialog that will only display Hello world in the top right corner of the screen. If you get confused by the MyHelloText class, just ignore it for the moment until you have read details on the definition of controls in the following chapter, Controls.
class MyHelloWorldDialog {
idd = -1; // set to -1, because we don't require a unique ID
movingEnable = false; // no movement while the dialog is shown
controlsBackground[] = { }; // no background controls needed
objects[] = { }; // no objects needed
controls[] = { MyHelloText }; // our Hello World text as seen below:
class MyHelloText {
type = 0; // CT_STATIC constant
style = 0; // ST_LEFT constant
text = "Hello world";
font = "TahomaB";
sizeEx = 0.023;
colorBackground[] = { 1, 1, 1, 0.3 };
colorText[] = { 0, 0, 0, 1 };
x = 0.8;
y = 0.1;
w = 0.2;
h = 0.05;
};
};
Controls
A few words about controls, as well as defining one. Crossreference to #Best Practice. IDCs, usage, etc.