ChatBox ​
Inherits: ChatViewer < HUDUIElement < Control
The chat box: a HUD element with tabs. A tab (ChatTab) is a list of channels (and, for the combat channels, the kinds of event); the box writes the lines of the message manager in the tabs that show their channel. The combat log is a tab of it. Set the tabs, the line limit and the look in the inspector of the scene (chat_box.tscn).
Description ​
The lines are written as they arrived: a line stays in the language it was written in. Place the box where you want it in your HUD; it is not a window.
Properties ​
Array[ChatTab] | tabs | [] |
int | line_limit | 200 |
bool | show_time | false |
int | font_size | 12 |
bool | allow_typing | true |
Key | focus_key | KEY_ENTER |
int | max_length | 255 |
LinkTooltip | link_tooltip | LinkTooltip.HOVER |
Methods ​
bool | accepts( channel_id: String ) |
bool | accepts_message( message: ChatMessage ) |
String | format_line( message: ChatMessage ) |
void | open_input( start_text: String = "" ) |
void | close_input() |
RichTextLabel | get_log( tab_index: int ) |
void | clear_logs() |
Enumerations ​
enum LinkTooltip ​
What a link in a line does
- HOVER =
0 - CLICK =
1 - NONE =
2
Property descriptions ​
Array[ChatTab] tabs = [] ​
The tabs of the box
int line_limit = 200 ​
How many lines each tab keeps (the oldest go first). 0 = no limit
bool show_time = false ​
Write the game time in front of each line
int font_size = 12 ​
The size of the text
bool allow_typing = true ​
The player can type: Enter opens a line to type in, / opens it with a slash, Enter sends and Esc closes it. A line is said; a line that starts with a slash is a command
Key focus_key = KEY_ENTER ​
The key that opens the line to type in
int max_length = 255 ​
The most characters of a line
LinkTooltip link_tooltip = LinkTooltip.HOVER ​
What the names of items and abilities in a line do. Hover: the tooltip shows while the mouse is over the name. Click: it shows when the name is clicked and goes when the mouse leaves the chat or a click lands elsewhere. None: the names are plain text and there is no tooltip
Method descriptions ​
bool accepts( channel_id: String ) ​
Does this viewer show a channel? By default the channels in its list. A viewer can override this (the fading messages show every channel that is marked as one) (from ChatViewer)
bool accepts_message( message: ChatMessage ) ​
Does this viewer show this message? By default when it shows one of the channels the message belongs to. A viewer that filters more (the chat box: the kind of a combat line) overrides this (from ChatViewer)
String format_line( message: ChatMessage ) ​
The line as it is written: the time (when shown) and the text, in the colour of the event or of the channel
void open_input( start_text: String = "" ) ​
Shows the line to type in, with a start of text
void close_input() ​
Closes the line to type in
RichTextLabel get_log( tab_index: int ) ​
The text area of a tab (for tests and for scripts)
void clear_logs() ​
Empties every tab