-- menu functions (if any) -- should define before menu; otherwise issues can happen local function teleportToGFZ() -- go back to GFZ1, unless it was replaced by something else G_SetCustomExitVars(1, 3) G_ExitLevel() end -- custom rendering example local function menuRender(v, menu) -- doesn't uses player and/or camera v.drawString(4, 4, "Hello", V_ALLOWLOWERCASE, "left") -- example string LM_DrawStandardMenu(v, menu) -- render the whole menu here end -- custom ticker example local function menuRender(menu) print("tick!") end -- custom handler example local function menuHandler(keyevent) if LM_PressedKey(keyevent, 241) -- KEY_DELETE LM_CloseMenu() end end -- menu definition -- you can actually put separated menu definitions is you wish -- as long these menus has one page at least local my_menu = { -- as a table with multiple tables on it { -- page 1 attributes = { -- different settings to modify pos = {30, 30}, -- 2-vector position header = {text = "My Menu", color = V_YELLOWMAP}, -- optional header with color start = {item = 2}, -- the cursor will be placed here when the menu enters this page previous = {page = -1, item = -1}, -- pressing ESC will lead to the previous page; if < 1 then the menu closes style = MMT_NORMAL -- there are 3 style types; this is the normal style imitating vanilla srb2 menus }, functions = { handler = nil, -- runs when a key is pressed, doesn't override default keyevents; use this for custom keypresses as an expansion ticker = nil, -- runs when this page is active; don't put logic that can actually affect the netcode drawer = nil, -- runs when the style is MMT_CUSTOM, is possible to make a hybrid with custom and normal/scroll styles }, content = { -- the whole content of the menu as items -- id: which type is; either can be header or string. header types are unaffected by flags, func, cvar and color -- flags: changes the behaviour of the item -- string: a representative text to display -- color: used by the string to change the color -- (Uses V_*MAP for different colors, if you don't want color then use 0 for white) -- -- func: used when MIF_FUNCTION flag is set, runs a function once ENTER is pressed -- cvar: used when one of the MIF_CVAR_* flags are set, controls a cvar by pressing left/right -- pos_y: vertical offset to render -- (If you want a very large menu then set the style to MMT_SCROLL for that or a your custom drawer if you want to) {id = MIT_HEADER, flags = 0, string = "Header", color = 0, func = nil, cvar = nil, pos_y = 0}, {id = MIT_STRING, flags = 0, string = "Text (does nothing)", color = 0, func = nil, cvar = nil, pos_y = 12}, {id = MIT_STRING, flags = MIF_FUNCTION, string = "Teleport to GFZ...", color = 0, func = teleportToGFZ, cvar = nil, pos_y = 22}, {id = MIT_STRING, flags = MIF_CVAR_STRING, string = "My Color", color = 0, func = nil, cvar = CV_FindVar("color"), pos_y = 42}, {id = MIT_STRING, flags = MIF_CVAR_NUMBER, string = "Max Players", color = 0, func = nil, cvar = CV_FindVar("maxplayers"), pos_y = 52}, {id = MIT_STRING, flags = MIF_DISABLED, string = "Don't use", color = V_REDMAP, func = nil, cvar = nil, pos_y = 72}, } } -- here can have page 2, page 3, page 4... and so on; there's no limit of pages } -- open the menu via a command COM_AddCommand("mymenu", function(player) LM_OpenMenu(my_menu, 1) end, 0)