Difference between revisions of "DialogControls-Text"

From Bohemia Interactive Community
Jump to navigation Jump to search
(CT_STRUCTURED_TEXT=13)
m (disamb)
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here. '''
+
{{Wiki|disamb}}
  
=== CT_STATIC=0 ===
+
* [[CT_STATIC]]
 
+
* [[CT_STRUCTURED_TEXT]]
Static controls represent exactly that: static data. Static means there is NO possible user interaction. CT_STATIC is primarily used for texts, dialog backgrounds, pictures (and video). The constant ''type'' property for these controls usually is <tt>CT_STATIC</tt>.
+
* [[CT_HTML]]
 
 
{| border="1" align="left" cellpadding="3" cellspacing="0" |
 
! colspan="3" bgcolor="#bbbbff" | Properties
 
|-
 
! bgcolor="#ddddff" | Name
 
! bgcolor="#ddddff" | Type
 
! bgcolor="#ddddff" | Remark
 
|-
 
| '''autoplay'''
 
| boolean
 
| Whether or not to autostart .ogv/.ogg file set as texture
 
|-
 
| '''loops'''
 
| integer
 
| How many times to play video
 
|-
 
| '''lineSpacing'''
 
| float
 
| Line spacing, required if the style was set to <tt>ST_MULTI</tt>
 
|-
 
| '''fixedWidth'''
 
| boolean
 
| Makes normal text like "LALALA" appear like "L A L A L A"
 
|-
 
| '''shadow'''
 
| integer
 
| Optional shadow style: 0 = none (default), 1 = drop shadow, 2 = outline
 
|-
 
| '''colorShadow'''
 
| array
 
| Sets color of the shadow under text, when '''shadow''' = 1;
 
|-
 
| '''blinkingPeriod'''
 
| float
 
| Speed with which control blinks, i.e. smoothly and repeatedly changes opacity from 1 to 0 and back
 
|}<br clear="all">
 
 
 
 
 
==== Static Text ====
 
[[Image:Dialog controls text.jpg|thumb||''Hello world'' text with semi-transparent background]]
 
Most often this type of control will be used to add text to dialogs. If you want the text to change dynamically while playing the mission, you should set the ''idc'' property to a positive number, which allows usage of the [[ctrlSetText]] function. Text alignment can be controlled using the ''style'' property and the <tt>ST_*</tt> constants.
 
 
 
By default, this will only display a '''single line''' (and cut the overflow); use <tt>ST_MULTI</tt> if you intend to use multiple lines. This also requires setting the property ''lineSpacing'', which indicates the relative space between lines; usually, you can set this to 1 for normal line spacing.
 
 
 
* '''Example:'''
 
<code><nowiki>
 
class RscText
 
{
 
access = 0;
 
type = CT_STATIC;
 
idc = -1;
 
style = ST_LEFT;
 
w = 0.1; h = 0.05;
 
//x and y are not part of a global class since each rsctext will be positioned 'somewhere'
 
font = "TahomaB";
 
sizeEx = 0.04;
 
colorBackground[] = {0,0,0,0};
 
colorText[] = {1,1,1,1};
 
text = "";
 
fixedWidth = 0;
 
shadow = 0;
 
};
 
class dialog
 
{
 
  class controls
 
  {
 
    class Background: RscText
 
    {
 
    text = "whatever";
 
    colorBackground[] = {0,0,0,1};
 
    x = 0;  y = 0;  w = 1;  h = 1;
 
    colorText[] = {0,0,0,0};
 
    };
 
  };
 
};
 
 
 
</nowiki></code>
 
 
 
==== Static Lines ====
 
class MyLine:RscText
 
{
 
      style = ST_LINE;
 
      colorText[] = {0.2941,0.8745,0.2157,1.0}; // to whatever gives you a thrill
 
};
 
==== Static Frames ====
 
class RscFrame
 
{
 
type = CT_STATIC;
 
idc = -1;
 
style = 64;
 
shadow = 2;
 
colorBackground[] = {0,0,0,0};
 
colorText[] = {1,1,1,1};
 
font = "Zeppelin32";
 
sizeEx = 0.02;
 
text = "";
 
};
 
 
 
==== Static Background ====
 
[[Image:Dialog controls background.jpg|thumb||Semi-transparent background]]
 
One can also use this control type to add solid background to dialogs by simply leaving the ''text'' property empty. This way, it will look like a regular rectangle.
 
 
 
* '''Example:'''
 
<code><nowiki>class MyRedBackgroundExample {
 
/* ... same as the text example, except for */
 
colorBackground[] = { 1, 0.1, 0.1, 0.8 };
 
text = "";
 
};</nowiki></code>
 
 
 
==== Static Pictures ====
 
Using specific style constants you can enhance your dialogs with pictures too. These pictures should reside in your mission folder as [[PAA File Format|paa]]-files. Then set your ''style'' property to <tt>ST_PICTURE</tt> (to display it once) or <tt>ST_TILE_PICTURE</tt> (to tile it) and use the ''text'' property to locate the paa image you want to use, relative to your addon or mission folder (''absolute paths cannot be used'').
 
 
 
[[Image:Dialog controls picture.jpg|thumb|100px|Dialog control showing a picture]]
 
* '''Example:'''
 
<code><nowiki>
 
class RscPicture
 
{
 
access = 0;
 
type = CT_STATIC;
 
idc = -1;
 
style = 48;//ST_PICTURE
 
colorBackground[] = {0,0,0,0};
 
colorText[] = {1,1,1,1};
 
font = "TahomaB";
 
sizeEx = 0;
 
lineSpacing = 0;
 
text = "";
 
fixedWidth = 0;
 
shadow = 0;
 
};
 
class dialog
 
{
 
class controls
 
{
 
  class Picture: RscPicture
 
  {
 
  text = "#(argb,8,8,3)color(1,1,1,1)";
 
  or
 
  text = "mypicture.paa";
 
  x = 0.46;
 
  y = 0.63;
 
  w = 0.08;
 
  h = 0.1;
 
  colorText[] = {0.4,0.6745,0.2784,1.0};// whatever gives you a thrill
 
  };
 
};
 
};
 
 
 
</nowiki></code>
 
 
 
====  Static Videos ====
 
[[Image:arma2oa_1.56.gif]]
 
 
 
All settings are same as for pictures, only source file must be of ''.OGV'' format. Two additional properties are available - ''autoplay'' (when 1, video starts automatically) and ''loops'' (defines how many times video will be played in loop).
 
 
 
For video encoding, you can use:
 
* ffmpeg2theora: http://www.v2v.cc/~j/ffmpeg2theora/download.html
 
* Theora Converter .NET: http://sourceforge.net/projects/theoraconverter/ (GUI for ffmpeg2theora)
 
 
 
* '''Example:'''
 
<code><nowiki>class MyVideoExample {
 
/* ... same as the picture example, with addition of */
 
text = "myVideo.ogv";
 
autoplay = 1;
 
loops = 10;
 
};</nowiki></code>
 
 
 
===CT_STRUCTURED_TEXT=13===
 
 
 
The Structured Text control can display [[Structured Text]]. This is a separate [[Data Types|data type]] in Arma.
 
 
 
Structured Text can not only hold some text values, it also can contain some attributes to format the text, as you can see in the example picture below.
 
 
 
You ''can'' contain a subclass '''Attributes''' to change the default attributes for your control. But the ''Attributes class'' and all of its attributes are ''optional'' and do not have to be specified.
 
 
 
{| border="1" align="left" cellpadding="3" cellspacing="0" |
 
! colspan="3" bgcolor="#bbbbff" | Properties
 
|-
 
! bgcolor="#ddddff" | Name
 
! bgcolor="#ddddff" | Type
 
! bgcolor="#ddddff" | Remark
 
|-
 
| '''size'''
 
| float
 
| Set the size of the text where 1 is the size value of parent class.
 
| 1
 
|-
 
| '''Attributes'''
 
| class
 
| see below
 
|-
 
| '''ShowImage'''
 
| boolean
 
| found in an xbox dialog and probably quite useless
 
|-
 
|}<br clear="all">
 
 
 
 
 
{| border="1" align="left" cellpadding="3" cellspacing="0" |
 
! colspan="4" bgcolor="#bbbbff" | Optional SubClass Attributes Properties
 
|-
 
! bgcolor="#ddddff" | Name
 
! bgcolor="#ddddff" | Type
 
! bgcolor="#ddddff" | Remark
 
! bgcolor="#ddddff" | Default Value
 
|-
 
| '''font'''
 
| string
 
| fontname to use
 
| "Zeppelin32"
 
|-
 
| '''size'''
 
| float
 
| Set the size of the text where 1 is the size value of parent class.
 
| 1
 
|-
 
| '''color'''
 
| string
 
| text color defined in HMTL-like syntax.
 
| "#ffffff"
 
|-
 
| '''align'''
 
| string
 
| align of text. Values can be "left", "center" or "right"
 
| "center"
 
|-
 
| '''valign'''
 
| string
 
| vertical align of text. Values can be "top", "middle", "bottom".
 
| "middle"
 
|-
 
| '''shadow'''
 
| integer
 
| affects the shadow of the text.
 
| 1 (true)
 
|-
 
| '''shadowColor'''
 
| string
 
| shadow color defined in HMTL-like syntax.
 
| "#000000"
 
|-
 
| '''shadowOffset'''
 
|
 
|
 
|
 
|-
 
| '''image'''
 
| string
 
|
 
|
 
|-
 
| '''underline'''
 
|
 
|
 
|
 
|-
 
| '''href'''
 
| string
 
|
 
|
 
|-
 
| '''linkColor'''
 
| string
 
|
 
|
 
|-
 
|}<br clear="all">
 
 
 
The following example uses almost the same code as the controls shown in the example screenshot.
 
[[Image:ControlStructuredText.jpg|thumb|400px|A StructuredText control based on sample code]]
 
* '''Example:'''
 
<code><nowiki>class MyRscStructuredText {
 
  idc = -1;
 
  type = CT_STRUCTURED_TEXT;  // defined constant
 
  style = ST_LEFT;            // defined constant
 
  colorBackground[] = { 1, 1, 1, 1 };
 
  x = 0.1;
 
  y = 0.1;
 
  w = 0.3;
 
  h = 0.1;
 
  size = 0.018;
 
  text = "";
 
  class Attributes {
 
    font = "TahomaB";
 
    color = "#000000";
 
    align = "center";
 
    valign = "middle";
 
    shadow = false;
 
    shadowColor = "#ff0000";
 
    size = "1";
 
  };
 
};</nowiki></code>
 
* '''Helpful Script Commands:'''
 
'''[[ctrlSetStructuredText]], [[lineBreak]], [[parseText]], [[composeText]], [[image]]'''
 
 
 
===CT_HTML=9===
 
 
 
The HTML control is well known as the "notebook" in the Map-View of the game. It can display a text over more pages and can inherit links to other, own defined sections. It has some simple formatting possibilities. It also can display images.
 
 
 
{| border="1" align="left" cellpadding="3" cellspacing="0" |
 
! colspan="3" bgcolor="#bbbbff" | Properties
 
|-
 
! bgcolor="#ddddff" | Name
 
! bgcolor="#ddddff" | Type
 
! bgcolor="#ddddff" | Remark
 
|-
 
| '''align'''
 
| string
 
| "center"
 
|-
 
| '''cyclelinks'''
 
| boolean
 
|
 
|-
 
| '''filename'''
 
| string
 
| the html file to load into the control at startup
 
|-
 
| '''text'''
 
| string
 
| the text the control should display. Leave it blank, if you set a '''filename'''
 
|-
 
| '''colorBold'''
 
| color array
 
| color of '''bold''' text (between &lt;b&gt; and </b> tags)
 
|-
 
| '''colorLink'''
 
| color array
 
| text color of links (between <a href="#Sectionname> and </a>)
 
|-
 
| '''colorLinkActive'''
 
| color array
 
| text color of the active link (normaly the fist on in page)
 
|-
 
| '''colorPicture'''
 
| color array
 
| color of transparent part of image
 
|-
 
| '''colorPictureBorder'''
 
| color array
 
| color of the borader arround image
 
|-
 
| '''colorPictureLink'''
 
| color array
 
| color of transparent part of image within links
 
|-
 
| '''colorPictureSelected'''
 
| color array
 
| color of transparent part of image within active links
 
|-
 
| '''tooltipColorText'''
 
| color array
 
 
|-
 
| '''tooltipColorBox'''
 
| color array
 
 
|-
 
| '''tooltipColorShade'''
 
| color array
 
 
|-
 
| '''prevPage'''
 
| string argb
 
| filename of image which is used as left arrow
 
|-
 
| '''nextPage'''
 
| string argb
 
| filename of image which is used as right arrow
 
|-
 
! colspan="3" bgcolor="#bbbbff" | Properties of subclass (H1-H6,P)
 
|-
 
! bgcolor="#ddddff" | Name
 
! bgcolor="#ddddff" | Type
 
! bgcolor="#ddddff" | Remark
 
|-
 
| '''font'''
 
| string
 
| font to use for default text
 
|-
 
| '''fontBold'''
 
| string
 
| font to use within bold tags
 
|-
 
| '''sizeEx'''
 
| float
 
| font size
 
|-
 
|}<br clear="all">
 
 
 
The following example uses almost the same code as the controls shown in the example screenshot.
 
[[Image:HTMLControl.jpg|thumb|400px|A HTML control with some different formatted text and links]]
 
* '''Example:'''
 
<code><nowiki>class MyRscHTML {
 
  idc = -1;
 
  type = CT_HTML; // defined constant (9)
 
  style = ST_LEFT; // defined constant (0)
 
 
 
  x = 0.1;
 
  y = 0.1;
 
  w = 0.6;
 
  h = 0.5;
 
 
 
  filename = "test.html";
 
  text="";
 
 
 
  colorBackground[] = {1,1,1,0.5};
 
  colorBold[] = {1, 0, 0, 1};
 
  colorLink[] = {0, 0, 1, 1};
 
  colorLinkActive[] = {1, 0, 0, 1};
 
  colorPicture[] = {1, 1, 1, 1};
 
  colorPictureBorder[] = {1, 0, 0, 1};
 
  colorPictureLink[] = {0, 0, 1, 1};
 
  colorPictureSelected[] = {0, 1, 0, 1};
 
  colorText[] = {0, 0, 0, 1};
 
 
 
  prevPage = "\ca\ui\data\arrow_left_ca.paa";
 
  nextPage = "\ca\ui\data\arrow_right_ca.paa";
 
 
class H1 {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.02474;
 
};
 
 
class H2 {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0286458;
 
};
 
 
class H3 {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0286458;
 
};
 
 
class H4 {
 
font = "Zeppelin33Italic";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0208333;
 
};
 
 
class H5 {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0208333;
 
};
 
 
class H6 {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0208333;
 
};
 
 
class P {
 
font = "Zeppelin32";
 
fontBold = "Zeppelin33";
 
sizeEx = 0.0208333;
 
};
 
};</nowiki></code>
 
* '''Helpful Script Commands:'''
 
'''[[htmlLoad]]'''
 
[[Category: Dialogs]]
 

Latest revision as of 14:37, 7 February 2021

Disambiguation
This disambiguation page lists articles associated with the same title.