ZScript menus

From ZDoom Wiki
Jump to navigation Jump to search
Note: This feature is for ZScript only.


As of GZDoom 2.4, most of the internal menu handling has been exported to ZScript, allowing for modders to create flexible and highly customizable menus. However, menus are also (one of) the most complex systems to work with in ZScript. Knowledge on the workings and mechanics of ZScript itself may help.

General Information

Before starting, knowing the scope system is highly recommended. Every menu and function except for Menu.SetMenu has a ui scope. This means only approved functions can access actors such as CountInv, which are marked within actors.txt as 'clearscope'.

Menus

Menus themselves are the very base foundations which hold items (see below), displaying and interacting them all on screen. Several types of menus are available:

Name Description
Menu The super class, inherited from by all menus internally.
ListMenu Used for Doom's main menu.
OptionMenu Used for most menus under the Options submenu.
GenericMenu A completely blank template for modders who wish to redesign menus in their own way.

NOTE: For completely custom menus, inheritance must be done with GenericMenu, NOT the base menu!

Each of these can be inherited by a child class to gain functions and properties. GenericMenu simply inherits and does not change anything from the base Menu class except for initialization, while ListMenu and OptionMenu come with a plethora of menu items and pre-programmed functionality.

Menu Items

Items are referred to the objects being displayed on screen while inside a menu, regardless of interactive or static. All items inherit from the super class MenuItemBase.

For a more exhaustive listing of items, see the class pages directly.

Name Parameters Parent Menu Type Description
MenuItemBase - - Super The super class, inherited from by all menu items internally.
OptionMenuItem
  • string label
  • name command
  • bool center = false
MenuItemBase OptionMenu The base class for all items used in OptionMenus. Not usable by itself.
ListMenuItem
  • double xofs
  • double yofs
  • TextureID tex
MenuItemBase ListMenu The base class for all items used in ListMenus. Not usable by itself.