HUD elements in Scripts¶
Script methods to manipulate hud elements.
Element Tree & Locating Elements¶
string Hud_GetHudName( var menu )
var GetParentMenu( var elem )
Returns a reference to the menu the passed element is parented to
var Hud_GetParent( var elem )
Returns the next higher parent of the element
bool Hud_HasChild( var elem, string childName )
Returns true
if the element has a child named like childName
var Hud_GetChild( var elem, string childName )
Returns the child element of the passed element named like childName
array GetElementsByClassname( var elem, string className )
Returns all children that have the given class
var GetElem( var menu, string elementName )
var Hud_GetScriptID( var elem )
Returns the script ID of the element declared in the .menu file
var GetFocus()
Returns the currently focused element.
Element Position¶
void Hud_SetPos( var elem, int x, int y )
Set the position of the element relative to the base position.
var Hud_GetPos( var elem )
Returns an array of type int[2]
as a var
. The position is relative to the element's base position.
void Hud_SetX( var elem, int x )
Only change the x position relative to the base position.
void Hud_SetY( var elem, int y )
Only change the y position relative to the base position.
int Hud_GetX( var elem )
Returns the x position of the element relative to it's base position.
int Hud_GetY( var elem )
Returns the y position of the element relative to it's base position.
void Hud_ReturnToBasePos( var elem )
Set the position of this element to it's base position.
var Hud_GetBasePos( var elem )
Returns an orray of type int[2]
as a var
. Base position is always [0,0]
int Hud_GetBaseX( var elem )
Returns the base x of this element.
var Hud_GetBaseY( var elem )
Returns the base y of this element.
var Hud_GetAbsPos( var elem )
Returns an array of type int[2]
as a var
. Absolute coordinates on the screen of this element.
int Hud_GetAbsX( var elem )
Returns the absolute x position on the screen of this element.
int Hud_GetAbsY( var elem )
Returns the absolute y position of the screen of this element.
!!! cpp-function "void Hud_SetXOverTime( var elem, int x, float transitionTime, int interpolation_mode "= 0 )
Move to relative x over time with interpolation.
* `INTERPOLATOR_LINEAR`: linear interpolation
* `INTERPOLATOR_ACCEL`: move with accelerating speed
* `INTERPOLATOR_DEACCEL`: move with deaccelerating speed
* `INTERPOLATOR_PULSE`: one time bounce
* `INTERPOLATOR_FLICKER`: no transition
* `INTERPOLATOR_SIMPLESPLINE`: ease in / out
* `INTERPOLATOR_BOUNCE`: gravitational bounce
!!! cpp-function "void Hud_SetYOverTime( var elem, int y, float transitionTime, int interpolation_mode "= 0 )
Move to relative y over time with interpolation
!!! cpp-function "void Hud_MoveOverTime( var elem, int x, int y, float transitionTime, int "interpolation_mode = 0 )
float Hud_GetRotation( var elem )
Returns the angles of the element
void Hud_SetRotation( var elem, float angles )
Set the angles of the element
Visibility & Color¶
void Hud_Show( var elem )
Make this element visible
void Hud_Hide( var elem )
Make this element invisible
bool Hud_IsVisible( var elem )
Returns true
if the element is visible
void Hud_SetVisible( var elem, bool visible )
Set if the element is visible
void Hud_SetColor( var elem, int r, int g, int b, int alpha )
Set the color of the element
!!! cpp-function "void Hud_ColorOverTime( var elem, int r, int g, int b, int alpha, float time, int "accel )
Change the color of the element over time
!!! cpp-function "void Hud_ColorOverTimeDelayed( var elem, int r, int g, int b, int alpha, float "time, ,float delay, int accel )
Change the color of the element over time
void Hud_SetAlpha( var elem, int alpha )
Change the opacity of the element
var Hud_GetBaseColor( var elem )
var Hud_GetBaseAlpha( var elem )
void Hud_SetPanelAlpha( var elem )
void Hud_FadeOverTime( var elem, int fadeTarget, float fadeTime )
Change the opacity of the element over time
void Hud_FadeOverTimeDelayed( var elem, int target, float delay, float accel )
Change the opacity of the element over time after a delay
Element Dimensions¶
int Hud_GetWidth( var elem )
Returns the current width of the element.
void Hud_SetWidth( var elem, int width )
Set the width of an element.
int Hud_GetBaseWidth( var elem )
Returns the width an element got initialized with.
int Hud_GetHeigth( var elem )
Returns the current height of an element.
void Hud_SetHeigth( var elem, int height )
Set the heigth of an element.
int Hud_GetBaseHeigth( var elem )
Returns the heigth an element got initialized with.
var Hud_GetSize( var elem )
Returns an array of type int[2]
as a var
. The first index is width and the second height of the element.
void Hud_SetSize( var elem, int x, int y )
Set width and height of the element.
var Hud_GetBaseSize( var elem )
Returns the width and height values the element got initialized with as an array of type int[2]
as var
.
!!! cpp-function "void Hud_ScaleOverTime( var elem, float width_factor, float height_factor, float "time, int interpolation_mode )
Set the width and height of the element over time.
The final width and height is calculated like this: `width * width_factor`
void Hud_SetScaleX( var elem, float xStretch )
Set the width of the element calculated with a factor.
void Hud_SetScaleY( var elem, float yStretch )
Set the height of the element calculated with a factor.
void Hud_ReturnToBaseSize( var elem )
Return to base width and height
Text¶
void Hud_SetText( var elem, string text )
Set the text content of this element
string Hud_GetText( var elem )
Returns the current text of the element. Useful for text inputs
void RHud_SetText( var elem, string text )
Set the text of an rui, if the element contains an rui that takes string input.
void Hud_SetUTF8Text( var elem, string text )
string Hud_GetUTF8Text( var elem )
Element Status¶
bool Hud_IsLocked( var elem )
Returns true
if the element is locked.
Locked elements are visible, can be focused and selected but don't trigger events and play a locked sound if they are selected
void Hud_SetLocked( var elem, bool locked )
Set this element locked status
bool Hud_IsEnabled( var elem )
Returns true
if the element is enabled
Disabled elements are visible but can't be focused or selected and don't trigger events.
void Hud_SetEnabled( var elem, bool enabled )
Set this element to be enabled / disabled
bool Hud_IsFocused( var elem )
Returns true
if this element is focused
Focused elements will be selected when pressing enter
void Hud_SetFocused( var elem )
Set the element to be focused
bool Hud_IsSelected( var elem )
Returns true
if this element is selected
void Hud_SetSelected( var elem, bool selected )
Set this element to be selected / not unselected
void Hud_SelectAll( var elem )
Select this element and all children
bool Hud_IsLabel( var elem )
Returns true
if the element is a label
Element RUI¶
bool Hud_IsRuiPanel( var elem )
Returns true
if this element can contain ruis
var Hud_GetRui( var elem )
Returns the rui instance of this element.
Navigation¶
void Hud_SetNavUp( var elem, var navTo )
Set the element that will be selected when navigating up (arrow up) from this selected element.
void Hud_SetNavDown( var elem, var navTo )
Set the element that will be selected when navigating up (arrow up) from this selected element.
void Hud_SetNavLeft( var elem, var navTo )
Set the element that will be selected when navigating left (arrow left) from this selected element.
void Hud_SetNavRight( var elem, var navTo )
Set the element that will be selected when navigating right (arrow right) from this selected element.
Events¶
void Hud_HandleEvent( var elem, int event )
Fire the specified event for the element
var Hud_AddEventHandler( var elem, int event, var functionref( var button ) )
Handle an event for the element
Accepted events:
-
UIE_CLICK
-
UIE_GET_FOCUS
-
UIE_LOSE_FOCUS
-
UIE_CHANGE
Other Visuals¶
void Hud_SetNew( var elem, bool isNew )
void Hud_SetImage( var elem, asset image )
Set the image displayed by the element, if the elements controlName allows for it.
void Hud_EnableKeyBindingIcons( var elem )
void Hud_RunAnimationScript( var elem, string animation )
Slider¶
void Hud_SliderControl_SetStepSize( var elem, float size )
void Hud_SliderControl_SetMin( var elem, float min )
void Hud_SliderControl_SetMax( var elem, float max )
float Hud_SliderControl_GetCurrentValue( var elem )
Graphs¶
void Hud_SetBarProgress( var elem, float progress )
Client Settings¶
void Hud_SetGamemodeIdx( var elem, int index )
void Hud_SetPlaylistVarName( var elem, string playlist )
Uncategorized¶
void Hud_DialogList_AddListItem( var elem, string val, string enum_ )
string Hud_GetListPanelSelectedItem( var elem )