Skip to content

Menu Properties

Game
Call Of Duty: Modern Warfare 2 (2009)

TODO

This will be a list of all available properties in menuDefs.

name

Usage: name <value>
  • value String The name of the menu.

Sets the name of the menu. It can be referenced by this name by other commands.

The name has to be unique compared to all other menus of the game. Otherwise one menu will overwrite the other.

Example
txt
{
    menuDef
    {
        name "TestMenu"
    }
}

fullScreen

Usage: fullScreen <value>
  • value Boolean

Marks a menu as fullscreen menu. This makes no underlying menus to be handled when it is open. Defaults to 0 when unset.

Example
txt
{
    menuDef
    {
        fullScreen 1
    }
}

screenSpace

Usage: screenSpace <value>
  • value Boolean

Unknown. Defaults to 0 when unset.

Example
txt
{
    menuDef
    {
        screenSpace 1
    }
}

decoration

Usage: decoration

Marks a menu as decoration. This makes it uninteractable.

Example
txt
{
    menuDef
    {
        decoration
    }
}

rect

Usage: rect <x> <y> <w> <h> [<alignHorizontal> <alignVertical>]
  • x Float The x coordinate of the upper left corner of the menu.
  • y Float The y coordinate of the upper left corner of the menu.
  • w Float The width of the menu.
  • h Float The height of the menu.
  • alignHorizontal Int Specifies how the menu is aligned horizontally.
  • alignVertical Int Specifies how the menu is aligned vertically.

Specifies the position and size of the menu. The unit of the coordinates and size depend on the align value. If no value for alignment was specified, 0 is taken by default.

Example
txt
{
    menuDef
    {
        rect 0 0 640 480 0 0
    }
}

style

Usage: style <value>
  • value Int Determines which styling is applied to the menu.

Sets the style for the menu. The style determines how the background is rendered. Defaults to 0 when unset.

Example
txt
{
    menuDef
    {
        style 1
    }
}

visible

Usage: visible <visibleExp> | when(<visibleExp>)
  • visibleExp Expression(Boolean) Determines whether menu is visible or not.

Instructs the game on how to determine whether a menu should be visible or not. Since this can be set to an expression it will be evaluated at runtime.

Since literal values are also a valid expressions, this can also be set to just 1 or 0 for example.

WARNING

The default for visible is 0 which means unless explicitly specified, your menu will be invisible. So while this is not necessarly required to be set, it is strongly recommended.

Example
{
    menuDef
    {
        visible 1
        visible when(0)
        visible when(dvarBool("ui_showTest") && dvarString("mapname") != "credits")
    }
}

onOpen

Usage: onOpen <handler>
  • handler EventHandler Handler to be executed upon being opened.

Specifies an event handler that is executed upon the menu being opened.

Example
{
    menuDef
    {
        onOpen
        {
            exec "set cl_paused 1";
            open otherMenu;
        }
    }
}

onClose

Usage: onClose <handler>
  • handler EventHandler Handler to be executed upon closing.

Specifies an event handler that is executed upon the menu being closed.

Example
{
    menuDef
    {
        onClose
        {
            exec "set cl_paused 0";
            close otherMenu;
        }
    }
}

onRequestClose

Usage: onRequestClose <handler>
  • handler EventHandler Handler to be executed on close being requested.

Specifies an event handler that is executed when the menu is requested to close but before closing. This can be used to add a closing animation or close other menus for example.

Example
{
    menuDef
    {
        onRequestClose
        {
            lerp x from 0 to 640 over "0.15";
            lerp alpha from 1 to 0 over "0.15";
        }
    }
}

onESC

Usage: onESC <handler>
  • handler EventHandler Handler to be executed on escape being pressed.

Specifies an event handler that is executed when the escape key is pressed. Usually useful to closing the menu or opening a popup.

Example
{
    menuDef
    {
        onESC
        {
            close self;
        }
    }
}

border

Usage: border <handler>
  • value Int

Specifies which kind of borders a menu should have.

Example
txt
{
    menuDef
    {
        border 1
    }
}

borderSize

Usage: borderSize <handler>
  • value Float

Specifies how wide the border of the menu should be.

Example
txt
{
    menuDef
    {
        borderSize 2.5
    }
}

backColor

Usage: backColor <r> <g> <b> <a>
  • r Float The red part of the color.
  • g Float The green part of the color.
  • b Float The blue part of the color.
  • a Float The alpha part of the color.

Specifies the background color of the menu. For the color to be visible it must have a style set that allows the color to be visible.

Example
txt
{
    menuDef
    {
        backColor 0.5 0.5 0.5 1
    }
}

foreColor

Usage: foreColor <r> <g> <b> <a>
  • r Float The red part of the color.
  • g Float The green part of the color.
  • b Float The blue part of the color.
  • a Float The alpha part of the color.

Specifies the text color of the menu.

Example
txt
{
    menuDef
    {
        foreColor 0.5 0.5 0.5 1
    }
}

borderColor

Usage: borderColor <r> <g> <b> <a>
  • r Float The red part of the color.
  • g Float The green part of the color.
  • b Float The blue part of the color.
  • a Float The alpha part of the color.

Specifies the border color of the menu.

Example
txt
{
    menuDef
    {
        borderColor 0.5 0.5 0.5 1
    }
}

focusColor

Usage: focusColor <r> <g> <b> <a>
  • r Float The red part of the color.
  • g Float The green part of the color.
  • b Float The blue part of the color.
  • a Float The alpha part of the color.

Specifies the color of the menu when it is focused.

Example
txt
{
    menuDef
    {
        focusColor 0.5 0.5 0.5 1
    }
}

outlineColor

Usage: outlineColor <r> <g> <b> <a>
  • r Float The red part of the color.
  • g Float The green part of the color.
  • b Float The blue part of the color.
  • a Float The alpha part of the color.

Specifies the color of the outline of the menu.

Example
txt
{
    menuDef
    {
        outlineColor 0.5 0.5 0.5 1
    }
}

background

Usage: background <material>
  • material String The name of the background material.

Sets the background for menu. It is only visible when the menu has a style set that allows the background to be a material.

Example
txt
{
    menuDef
    {
        background "mw2_main_background"
    }
}

ownerDraw

Usage: ownerDraw <ownerDrawType>
  • ownerDrawType Int The name of the background material.

Instructs the game to draw at the specified location using draw logic implemented in the game code. This is used to draw more complicated things that a menu could not handle.

The ownerDrawType defines what is drawn. Any implementation has its own type number.

Example
txt
{
    menuDef
    {
        ownerDraw 156
    }
}

ownerDrawFlag

Usage: ownerDrawFlag <flag>
  • flag Int The flag value to set

Sets a flag to be interpreted by the specified ownerdraw.

Example
txt
{
    menuDef
    {
        ownerDrawFlag 8
    }
}

outOfBoundsClick

Usage: outOfBoundsClick

Specifies an event handler that is executed when the escape key is pressed. Usually useful to closing the menu or opening a popup.

Example
txt
{
    menuDef
    {
        outOfBoundsClick
    }
}

soundLoop

Usage: soundLoop <soundLoopName>
  • soundLoop String The name of the sound alias to play in a loop.

Sets the sound that should be played in a loop while this menu is open.

Example
txt
{
    menuDef
    {
        soundLoop "music_mainmenu_mp"
    }
}

exp rect x

Usage: exp rect x <exp>
  • exp Expression(Float) The expression that evaluates to the x position.

Sets an expression for the x position of the menu that is evaluated at runtime.

Example
{
    menuDef
    {
        exp rect x 0 - ((float(milliseconds() % 60000) / 60000) * (854));
    }
}

exp rect y

Usage: exp rect y <exp>
  • exp Expression(Float) The expression that evaluates to the y position.

Sets an expression for the y position of the menu that is evaluated at runtime.

Example
{
    menuDef
    {
        exp rect y localvarint("ui_AttachmentY") + 18;
    }
}

exp rect w

Usage: exp rect w <exp>
  • exp Expression(Float) The expression that evaluates to the width.

Sets an expression for the width of the menu that is evaluated at runtime.

Example
{
    menuDef
    {
        exp rect w 80 + (sin(milliseconds() / 90)) * 4;
    }
}

exp rect h

Usage: exp rect h <exp>
  • exp Expression(Float) The expression that evaluates to the height.

Sets an expression for the height of the menu that is evaluated at runtime.

Example
{
    menuDef
    {
        exp rect h 40 + (sin(milliseconds() / 90)) * 2;
    }
}

exp openSound

Usage: exp openSound <exp>
  • exp Expression(String) An expression that evaluates to the name of a soundalias.

Sets an expression for the name of the soundalias that is played upon opening the menu.

Since literal values are also a valid expressions, this can also be set to a string.

Example
{
    menuDef
    {
        exp openSound "mouse_click";
        exp openSound localvarstring("ui_openSound");
    }
}

exp closeSound

Usage: exp closeSound <exp>
  • exp Expression(String) An expression that evaluates to the name of a soundalias.

Sets an expression for the name of the soundalias that is played upon closing the menu.

Since literal values are also a valid expressions, this can also be set to a string.

Example
{
    menuDef
    {
        exp closeSound "mouse_click";
        exp closeSound localvarstring("ui_closeSound");
    }
}
Usage: popup

Marks a menu as popup.

Example
txt
{
    menuDef
    {
        popup
    }
}

fadeClamp

Usage: fadeClamp <value>
  • value Float

Unknown.

Example
txt
{
    menuDef
    {
        fadeClamp 1.0
    }
}

fadeCycle

Usage: fadeCycle <value>
  • value Int

Unknown.

Example
txt
{
    menuDef
    {
        fadeCycle 1
    }
}

fadeAmount

Usage: fadeAmount <value>
  • value Float

Unknown.

Example
txt
{
    menuDef
    {
        fadeAmount 0.1
    }
}

fadeInAmount

Usage: fadeInAmount <value>
  • value Float

Unknown.

Example
txt
{
    menuDef
    {
        fadeInAmount 0.002
    }
}

execKey

Usage: execKey <key> <handler>
  • key String A string containing the handled key as the single character.
  • handler EventHandler Handler to be executed when the specified key is pressed.

Sets a handler to be executed when a given key is pressed.

The value of the key is specified as a string that has to contain exactly one character. The key corresponding to the symbol in the string is then handled.

If a key is supposed to be handled that has no symbol like for example the escape key or gamepad buttons, you will have to use the execKeyInt instead.

Example
{
    menuDef
    {
        execKey "2"
        {
            play "mouse_click";
            exec "cmd callvote map_restart";
            close callvote;
        }
    }
}

execKeyInt

Usage: execKeyInt <keyCode> <handler>
  • keyCode Int The key code of the key to be handled.
  • handler EventHandler Handler to be executed when the specified key is pressed.

Sets a handler to be executed when a given key is pressed.

The value of the key is specified as its numeric code.

Example
{
    menuDef
    {
        execKeyInt 23
        {
            setfocus sidenav_button_31;
        }
    }
}

blurWorld

Usage: blurWorld <blurAmount>
  • blurAmount Float

Makes the game blur the rendered world behind the menu. Only noticable if the menu is not fullscreen or has transparency.

The amount of blur can be set using the parameter.

Example
txt
{
    menuDef
    {
        blurWorld 7.0
    }
}

legacySplitScreenScale

Usage: legacySplitScreenScale

Unknown.

Example
txt
{
    menuDef
    {
        legacySplitScreenScale
    }
}

hiddenDuringScope

Usage: hiddenDuringScope

Hides the menu while aiming down sight.

Example
txt
{
    menuDef
    {
        hiddenDuringScope
    }
}

hiddenDuringFlashbang

Usage: hiddenDuringFlashbang

Hides the menu while suffering under the effect of a flashbang.

Example
txt
{
    menuDef
    {
        hiddenDuringFlashbang
    }
}

hiddenDuringUI

Usage: hiddenDuringUI

Unknown.

Example
txt
{
    menuDef
    {
        hiddenDuringUI
    }
}

allowedBinding

Usage: allowedBinding <binding>
  • binding String

Unknown.

Example
txt
{
    menuDef
    {
        allowedBinding "+talk"
    }
}

textOnlyFocus

Usage: textOnlyFocus

Unknown.

Example
txt
{
    menuDef
    {
        textOnlyFocus
    }
}
exp soundLoop Usage: exp soundLoop <exp>
  • exp Expression(String) An expression that evaluates to the name of a soundalias.

Sets an expression for the name of the soundalias that is played in a loop while this menu is open.

Since literal values are also a valid expressions, this can also be set to a string.

Example
{
    menuDef
    {
        exp soundLoop "music_mainmenu_mp";
        exp soundLoop localvarstring("ui_soundLoop");
    }
}
onFocusDueToClose Usage: onFocusDueToClose <handler>
  • handler EventHandler Handler to be executed upon receiving focus due to another menu being closed.

Specifies an event handler that is executed upon the menu getting focus due to another menu being closed.

Example
{
    menuDef
    {
        onFocusDueToClose
        {
            setLocalVarString "ui_hint_text" "";
            focusfirst;
        }
    }
}

All trademarks are owned by their respective owners. This project is neither endorsed by, nor affiliated with Activision, Treyarch, Infinity Ward or any of their descendants.