From ZDoom Wiki
Jump to: navigation, search

ZDoom's new menu system uses a special MENUDEF lump to define the menus. Using the MENUDEF syntax, it is possible to update existing menus and define additional ones.

Note: Much of the menu structure defined here is accessed internally by CCMDs and menu generation code. If you want to design your own menus make sure that they are named identically and that links to all important submenus are present.

The basic syntax is similar to SBARINFO, however it does not use semicolons to end statements.

BlockType "BlockName"
    Key Value
    Key Value1, Value2

The main block types are the following:

A list of commands, such as the main menu in the various games.
A list of options, pairing each one with its current value.
A way to pair meaningful names to values, they are referenced by OptionMenus.
A way to pair a user displayed name to a string CVar.

A menu block can contain different kinds of instructions, settings and actions, as well as conditional subblocks.


An instruction changes how the next elements will be treated. Instructions include:

Font "<font name>" [, "<font color>" ] [, "<highlight color>" ]
Chooses which font will be used from then on. Caution: this will not work in OptionMenus and will make ZDoom spit an error at loadup.
Linespacing <y>
Changes how much space to leave in between each line.
LabelOffset <x>
Changes how much labels are offset.
PlayerDisplay <x>, <y>, "RR GG BB", "RR GG BB"
Changes the position of the box where the player character is shown in the Player Class selection menu (when a new game is started). The color definitions (in hex) define the range of the background.
Position <x>, <y>
Forcibly changes the starting position for the next element. (The position of the each element is normally automatically calculated from the position of its predecessor.)
Selector "<graphic>", <x>, <y>
Changes the graphic used to indicate the currently selected menu item in a ListMenu. Graphic is the name of a graphic to use, "M_SKULL1" for example. using "-" as the graphic name will instead use the small cursor provided in the Console font, like in option menus, and will make it blink. The coordinates provided are offsets from the current menu item.
StaticText "<text>" [, <bool centered> ]
Displays non-interactive text.
StaticTextCentered <x>, <y>, "<text>"
Displays non-interactive text centered at the specified position.
StaticTextSwitchable "<text_off>", "<text_on>", "<value>"
Displays the given text depending on value.
StaticPatch <x>, <y>, "<lump>"
Displays a non-interactive image lump.
StaticPatchCentered <x>, <y>, "<lump>"
Displays a non-interactive image lump centered at the specified position.
Title "<text>"
Displays a title for an OptionMenu. Does not work with ListMenu.
ValueText "<text>", "<CVAR>" [, "<OptionValue reference>" ]
(Verification needed)


A setting is a way to change something, generally a console variable. Types of settings include:

Control "<label>", "<command>"
For changing key bindings
MapControl "<label>", "<command>"
For changing automap key bindings
Option "<label>", "<CVAR>", "<OptionValue reference>", [Center]
Allows you to set a console variable to different values, using an OptionValue block as a reference to give names to these values. "OnOff" will work for a default two switch toggle without having to make a new definition.
Slider "<label>", "<CVAR>", <minimum>, <maximum>, <inc> [, <decimal places> ]
Allows you to set a console variable to a range of values between <min> and <max>, using steps of <inc> units. You can optionally set how many decimals places are shown (defaults to 1).
ColorPicker "<label>", "<CVAR>"
Allows you to set a console variable to a chosen color.


A command performs an action when activated. Types of commands include:

PatchItem "<lump>", "<key>", "<menu block reference>"
Opens a menu, and allows to use key as a shortcut to activate it directly.
TextItem "<label>", "<key>, "<menu block reference>"
Opens a menu, and allows to use key as a shortcut to activate it directly.
Submenu "<label>", "<menu block reference>"
Opens the listed submenu.
Command "<label>", "<command>"
Calls a console command.
SafeCommand "<label>", "<command>"
Calls a console command with an additional confirmation.

If statements

If/else statements allow certain menu items to appear for different scenarios.

IfGame(<game> [, ...] ) {}
Uses the code if the current game is one of those listed.
IfOption(<option>) {}
Executes the subblock if the given setting evaluates to true.
Else {}
Executes the subblock if the prior if statement did not succeed.


Nuvolachalk.png Note: This article lists no examples. If you make use of this feature in your own project(s) or know of any basic examples that could be shared, please add them. This will make it easier to understand for future authors seeking assistance. Your contibutions are greatly appreciated.