GetChatboxLayout: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Add 'chat_text_outline')
 
(15 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Client function}}
{{Client function}}
{{Needs Checking|Returns a table now --[[User:Sebassje|Sebas]] 17:27, 8 May 2010 (UTC)}}
Returns information about how the chatbox looks.
Returns information about how the chatbox looks. These values comes from the file called: [[Chatboxpresents.xml]] but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.
 
These values come from the file called: [[Chatboxpresets.xml]] but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.


==Syntax==
==Syntax==
<syntaxhighlight lang="lua">int getChatboxLayout ( string CVar )</syntaxhighlight>
<syntaxhighlight lang="lua">bool|int|table getChatboxLayout ( [ string CVar ] )</syntaxhighlight>


===Required Arguments===
===Optional Arguments===
*'''CVar:''' the name of the property you want returned. Can be the following values:
*'''CVar:''' the name of the property you want returned. Can be the following values:
**'''chat_font''' - Returns the chatbox font
**'''chat_font''' - Returns the chatbox font
Line 17: Line 18:
**'''chat_input_text_color''' - Returns the color of the text in the chatbox input
**'''chat_input_text_color''' - Returns the color of the text in the chatbox input
**'''chat_scale''' - Returns the scale of the text in the chatbox
**'''chat_scale''' - Returns the scale of the text in the chatbox
**'''chat_position_offset_x''' - Returns the x position offset setting
**'''chat_position_offset_y''' - Returns the y position offset setting
**'''chat_position_horizontal''' - Returns the horizontal alignment setting
**'''chat_position_vertical''' - Returns the vertical alignment setting
**'''chat_text_alignment''' - Returns the text alignment setting
**'''chat_width''' - Returns the scale of the background width
**'''chat_width''' - Returns the scale of the background width
**'''chat_css_style_text''' - Returns whether text fades out over time
**'''chat_css_style_text''' - Returns whether text fades out over time
Line 24: Line 30:
**'''chat_use_cegui''' - Returns whether CEGUI is used to render the chatbox
**'''chat_use_cegui''' - Returns whether CEGUI is used to render the chatbox
**'''text_scale''' - Returns text scale
**'''text_scale''' - Returns text scale
**{{Added feature/item|1.6.0|1.5.9|21160|'''chat_text_outline''' - Returns whether text black/white outline is used}}


===Returns===
===Returns===
Line 29: Line 36:
*2 numbers if '''chat_scale''' was entered
*2 numbers if '''chat_scale''' was entered
*1 number if any other CVar was specified
*1 number if any other CVar was specified
*a table of all CVar values, if CVar was not specified
*''false'' if an invalid CVar was specified
*''false'' if an invalid CVar was specified


==Example==
==Example==
This code makes the chatbox empty when you type /clear  
This code makes the chatbox empty when you type /clear  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua" category="client">
addCommandHandler("clear",
addCommandHandler("clear",
     function ()
     function ()
         local lines = getChatboxLayout()["chat_lines"]
         local lines = getChatboxLayout()["chat_lines"]
         for i=1,lines do
         for i = 1, lines do
             outputChatBox("")
             outputChatBox("")
         end
         end
    end
)
</syntaxhighlight>
This code makes the chatbox empty when you type /clear, but with a cleaner code
<syntaxhighlight lang="lua"  category="client">
addCommandHandler("clear",
    function ()
        outputChatbox(('\n'):rep(getChatboxLayout("chat_lines")));
     end
     end
)
)
Line 46: Line 63:
==See Also==
==See Also==
{{GUI_functions}}
{{GUI_functions}}
{{GUI_events}}
[[en:getChatboxLayout]]
[[ru:getChatboxLayout]]

Latest revision as of 19:15, 12 April 2022

Returns information about how the chatbox looks.

These values come from the file called: Chatboxpresets.xml but it depends on what type of preset you currently have, which is chosen from your settings in the 'Interface' tab.

Syntax

bool|int|table getChatboxLayout ( [ string CVar ] )

Optional Arguments

  • CVar: the name of the property you want returned. Can be the following values:
    • chat_font - Returns the chatbox font
    • chat_lines - Returns how many lines the chatbox has
    • chat_color - Returns the background color of the chatbox
    • chat_text_color - Returns the chatbox text color
    • chat_input_color - Returns the background color of the chatbox input
    • chat_input_prefix_color - Returns the color of the input prefix text
    • chat_input_text_color - Returns the color of the text in the chatbox input
    • chat_scale - Returns the scale of the text in the chatbox
    • chat_position_offset_x - Returns the x position offset setting
    • chat_position_offset_y - Returns the y position offset setting
    • chat_position_horizontal - Returns the horizontal alignment setting
    • chat_position_vertical - Returns the vertical alignment setting
    • chat_text_alignment - Returns the text alignment setting
    • chat_width - Returns the scale of the background width
    • chat_css_style_text - Returns whether text fades out over time
    • chat_css_style_background - Returns whether the background fades out over time
    • chat_line_life - Returns how long it takes for text to start fading out
    • chat_line_fade_out - Returns how long takes for text to fade out
    • chat_use_cegui - Returns whether CEGUI is used to render the chatbox
    • text_scale - Returns text scale
    • chat_text_outline - Returns whether text black/white outline is used

Returns

  • 4 numbers if the CVar contains "color"
  • 2 numbers if chat_scale was entered
  • 1 number if any other CVar was specified
  • a table of all CVar values, if CVar was not specified
  • false if an invalid CVar was specified

Example

This code makes the chatbox empty when you type /clear

addCommandHandler("clear",
    function ()
        local lines = getChatboxLayout()["chat_lines"]
        for i = 1, lines do
            outputChatBox("")
        end
    end
)

This code makes the chatbox empty when you type /clear, but with a cleaner code

addCommandHandler("clear",
    function ()
        outputChatbox(('\n'):rep(getChatboxLayout("chat_lines")));
    end
)

See Also

General functions

Browsers

Buttons

Checkboxes

Comboboxes

Edit Boxes

Gridlists

Memos

Progressbars

Radio Buttons

Scrollbars

Scrollpanes

Static Images

Tab Panels

Tabs

Text Labels

Windows

Input

GUI