This is the most left point of the canvas where your text should be shown.
4
y
Number
This is the most top point of the canvas where your text should be shown.
5
width
Number
The text width on the canvas.
6
height
Number
The text height on the canvas.
Style
Separate arguments with a semicolon. -fx- names are accepted too.
Argument
Type
Description
font
String
Font family, or a TTF file in the instrument resources folder.
size
Number
Font size in pixels.
spacing
Number
Space between letters, in pixels.
color
String
A name such as white, or a hex color. #RRGGBBAA is red, green, blue, alpha.
halign
String
left, center, or right.
valign
String
top, center, or bottom.
visible
Boolean
false hides the text.
opacity
Number
0.0 invisible to 1.0 fully visible.
background_color
String
A color behind the text box.
angle_z
Number
Rotation in degrees, in instrument space.
Example
-- Altitude in feet, right-aligned in the drum window
alt = txt_add("0", "font:Roboto-Bold.ttf; size:28; color:#f2f4f6; halign:right;", 140, 96, 80, 36)
Photo slot: shots/txt_add.png
txt_set
Simulation Instrument Studio 1
Overloads
txt_set(txt_id, text)
Changes the text of an existing text box.
Parameters
#
Name
Type
Description
1
txt_id
Number
Reference to a txt object
2
txt
String
This is the txt being shown
Example
alt = txt_add("0", "size:28; color:white; halign:right;", 140, 96, 80, 36)
-- Sim sent 3450 fttxt_set(alt, "3450")
Photo slot: shots/txt_set.png
txt_style
Simulation Instrument Studio 1
Overloads
txt_style(txt_id,style)
Replaces the style of a text box. Keys you do not name keep their current value only if you name opacity and visible.
Parameters
#
Name
Type
Description
1
txt_id
Number
Text identifier. This number can be obtained by calling txt_add.
2
style
String
The new style to apply. See txt_add for styling options.
Example
qnh = txt_add("29.92", "size:16; color:#c8d0d8;", 90, 180, 60, 22)
-- Kollsman window is in range. Make it brighter.txt_style(qnh, "size:18; color:#ffffff;")
Photo slot: shots/txt_style.png
running_txt_add_cir
Simulation Instrument Studio 1
Overloads
running_txt_add_cir(x, y, nr_visible_items, item_width, item_height, radius, value_callback, style)
running_txt_add_cir(x, y, nr_visible_items, item_width, item_height, radius_x, radius_y, value_callback, style)
A strip of text items that scrolls as the caret moves.
Parameters
#
Name
Type
Description
1
x
Number
This is the most left point of the canvas where your running text should be shown.
2
y
Number
This is the most top point of the canvas where your running text should be shown.
3
nr_visible_items
Number
Number of text items that should be shown.
4
item_width
Number
The width of every text object in pixels.
5
item_height
Number
The height of every text object in pixels.
6
radius_x
Number
The horizontal radius from the middle of the circle in pixels.
7
radius_y
Number
(Optional) The vertical radius from the middle of the circle in pixels. When not present, radius_x is used.
8
value_callback
Function
Callback function which will ask for the text that should be shown.
9
style
String or Function
The style to use. More information on styles.
Example
-- Compass card. Twelve labels on a 110 px radius.
function card_label(i)
local marks = {"N","3","6","E","12","15","S","21","24","W","30","33"}
return marks[(i % 12) + 1]
end
card = running_txt_add_cir(160, 160, 12, 28, 28, 110, card_label, "size:14; color:white; halign:center; valign:center")
Photo slot: shots/running_txt_add_cir.png
running_txt_add_hor
Simulation Instrument Studio 1
Overloads
running_txt_add_hor(x, y, nr_visible_items, item_width, item_height, value_callback, style)
A strip of text items that scrolls as the caret moves.
Parameters
#
Name
Type
Description
1
x
Number
This is the most left point of the canvas where your running text should be shown.
2
y
Number
This is the most top point of the canvas where your running text should be shown.
3
nr_visible_items
Number
Number of text items that should be shown.
4
item_width
Number
The width of every text object in pixels.
5
item_height
Number
The height of every text object in pixels.
6
value_callback
Function
Callback function which will ask for the text that should be shown.
7
style
String or Function
The style to use.
Example
function freq(i)
return string.format("1%02d.%02d", 18 + i, 0)
end
-- A row of comm presets
presets = running_txt_add_hor(20, 200, 6, 70, 24, freq, "size:14; color:#9bd; halign:center;")
running_txt_move_carot(presets, 0)
Photo slot: shots/running_txt_add_hor.png
running_txt_add_ver
Simulation Instrument Studio 1
Overloads
running_txt_add_ver(x, y, nr_visible_items, item_width, item_height, value_callback, style)
A strip of text items that scrolls as the caret moves.
Parameters
#
Name
Type
Description
1
x
Number
This is the most left point of the canvas where your running text should be shown.
2
y
Number
This is the most top point of the canvas where your running text should be shown.
3
nr_visible_items
Number
Number of text items that should be shown.
4
item_width
Number
The width of every text object in pixels.
5
item_height
Number
The height of every text object in pixels.
6
value_callback
Function
Callback function which will ask for the text that should be shown.
7
style
String
The style to use. See txt_add for available style properties.
Example
function notch(i)
return tostring(i * 10)
end
-- Flap degrees, top to bottom
flap_labels = running_txt_add_ver(12, 20, 4, 40, 28, notch, "size:14; color:white;")
running_txt_move_carot(flap_labels, 1)
Photo slot: shots/running_txt_add_ver.png
running_txt_move_carot
Simulation Instrument Studio 1
Overloads
running_txt_move_carot(running_txt_id, position)
Sets the caret of a running text.
Parameters
#
Name
Type
Description
1
running_txt_id
Number
The running txt id of which to move the carot
2
position
Number
The position to move the carot to.
Example
function card_label(i)
local marks = {"N","3","6","E","12","15","S","21","24","W","30","33"}
return marks[(i % 12) + 1]
end
card = running_txt_add_cir(160, 160, 12, 28, 28, 110, card_label, "size:14; color:white; halign:center;")
-- Heading 090. East is the fourth mark.running_txt_move_carot(card, 3)