Przejdź do treści
Gothic Multiplayer
Gothic MP Wiki

Functions

Creating menu windows, the game's Settings window, buttons of the ESC menu.

since 0.1.0-alpha

Windows (Menu) in the style of the game's Settings screen and buttons of the ESC menu (MenuButton).

createMenu

since 0.1.30-alpha
createMenu(title)

Creates a window in the style of the game's Settings screen - tabs with controls (see Menu). The window is only described here; it is shown with menu:open(), a button of the ESC menu (addMenuButton) or a button of another window (MenuPage:addButton).

local menu = createMenu("Lorem ipsum")
local page = menu:addPage("Dolor sit")
page:addToggle("Consectetur", true)
addMenuButton("Lorem ipsum", menu)
ParameterTypeDescription
titlestringTitle shown at the top of the window.

Returns: Menu - The new window.

getSettingsMenu

since 0.1.30-alpha
getSettingsMenu()

Returns the game's own Settings window (ESC - SETTINGS). Scripts can add their tabs to it (getSettingsMenu():addPage("Lorem ipsum")) - they appear after the game's tabs. It cannot be opened, closed, renamed or removed by scripts.

Returns: Menu - The game's Settings window (always the same object).

addMenuButton

since 0.1.30-alpha
addMenuButton(text, action)

Adds a button to the ESC menu (between SETTINGS and QUIT, in the order of adding). Clicking it calls the function or opens the given window.

addMenuButton("Lorem ipsum", menu)
addMenuButton("Dolor sit amet", function() addChatMessage("Lorem ipsum dolor sit amet.") end)
ParameterTypeDescription
textstringText of the button.
actionfun() | MenuFunction called on click (no arguments), or a window to open.

Returns: MenuButton - The new button.

isMenuOpen

since 0.1.30-alpha
isMenuOpen()

Tells whether the ESC menu or any window opened from it (the game's Settings, a script window) is open.

Returns: boolean

closeMenu

since 0.1.30-alpha
closeMenu()

Closes the ESC menu together with every window opened on top of it (the game's Settings, script windows) - the player returns to the game.