SetChatAlpha: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Client function}} This function sets the global alpha value of the in-game chat. The alpha value applies to text output, input line and background colors. ==Syntax=...")
 
No edit summary
Line 7: Line 7:
bool setChatAlpha ( float alpha )
bool setChatAlpha ( float alpha )
</syntaxhighlight>  
</syntaxhighlight>  
===Required Arguments===
*'''alpha:''' the new global alpha value for the in-game chat (0-255)


===Returns===
===Returns===

Revision as of 07:08, 10 July 2013

This function sets the global alpha value of the in-game chat. The alpha value applies to text output, input line and background colors.

Syntax

bool setChatAlpha ( float alpha )

Required Arguments

  • alpha: the new global alpha value for the in-game chat (0-255)

Returns

Returns true if alpha is a number and resides in a valid range (0-255), false if alpha is not a number or resides in an invalid range (like 9001).

Example

This example makes everybodies chatbox flash in 1 second intervals.

local startTime = getTickCount()
local interval = 1000 -- time in milliseconds
local baseAlpha = 200 -- the alpha value the chat will at least have
                      -- valid: 0 - 255

addEventHandler( "onClientRender", root,
    function()
        local elapsedTime = getTickCount() - startTime
        local modAlpha = ( 255 - baseAlpha ) / 2
        local alpha = math.sin( elapsedTime / interval * math.pi * 2 ) * modAlpha
                      + baseAlpha + modAlpha
                      
        setChatAlpha( alpha )
    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