ui
Create and manage menu elements (groupboxes, checkboxes, sliders, buttons, etc.) in the cheat interface. Use config_name with config get/set to read and save values.
Creation
ui.create_groupbox(tab: string, side: string, name: string, height: number)
- Creates a groupbox within the specified tab of the menu.
secret.ui.create_groupbox("lua", "right", "elements", 200)
ui.create_checkbox(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a checkbox UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_button(tab: string, groupbox: string, name: string, callback: function): number
- Creates a button UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_slider(tab: string, groupbox: string, name: string, min: number, max: number, config_name: string): number
- Creates a slider UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_colorpicker(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a colorpicker UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_inputbox(tab: string, groupbox: string, name: string, config_name: string): number
- Creates an inputbox UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_hotkey(tab: string, groupbox: string, name: string, config_name: string): number
- Creates a hotkey UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
secret.ui.create_groupbox("lua", "right", "elements", 200) -- create a groupbox called "elements"
-- create and check lua hotkeys
secret.ui.create_hotkey("lua", "elements", "my hotkey", "lua_hotkey")
if secret.config.get("lua_hotkey") then
print("our lua hotkey is on!")
end
ui.create_dropdown(tab: string, groupbox: string, name: string, config_name: string, items: table, multi: boolean): number
- Creates a dropdown UI element within the specified tab and groupbox of the menu.
- Returns a numeric ID for the created element that can be used to update or remove it later.
secret.ui.create_groupbox("lua", "right", "elements", 200) -- create a groupbox called "elements"
secret.ui.create_dropdown("lua", "elements", "My Lua Dropdown", "lua_dropdown", {"Item1", "Item2", "Item3"}, false)
ui.create_playerlist_text(text: string, index: number): number
- Creates a text UI element in the playerlist advanced panel identified by the given index.
- Returns a numeric ID for the created element that can be used to update or remove it later.
ui.create_playerlist_button(name: string, index: number, callback: function): number
- Creates a button UI element in the playerlist advanced panel identified by the given index.
- Do note that the callback will return the index as a param.
- Returns a numeric ID for the created element that can be used to update or remove it later.
Updates & removal
ui.update(index: number, new_value: string|table)
- Updates the UI element at the given index.
secret.ui.update(checkbox_id, "New Checkbox Label") -- update checkbox/button/inputbox label
secret.ui.update(button_id, "New Button Label")
secret.ui.update(inputbox_id, "New Input Label")
secret.ui.update(dropdown_id, {"NewItem1", "NewItem2"})
secret.ui.update(slider_id, { min = 0, max = 100 })
ui.remove(index: number)
- Removes the UI element at the given index.
secret.ui.remove(checkbox_id)
Groupbox
ui.update_groupbox(tab: string, groupbox_name: string, update_value: string|table|number)
- Updates properties of an existing groupbox.
-- update groupbox name
secret.ui.update_groupbox("lua", "elements", "new_elements")
-- update multiple properties
secret.ui.update_groupbox("lua", "elements", { name = "new_elements", side = "left", height = 150 })
-- update height only
secret.ui.update_groupbox("lua", "elements", 300)
ui.remove_groupbox(tab: string, groupbox_name: string)
- Removes the specified groupbox.
secret.ui.remove_groupbox("lua", "elements")
State & notifications
ui.clear_elements()
- Clears all the current elements made with lua, such as secret.ui.create_checkbox, etc.
ui.menu_open(): boolean
- Returns a boolean value of the menu being open.
ui.mouse_pos(): (x: number, y: number)
- Returns the current mouse position.
local mx, my = secret.ui.mouse_pos()
ui.mouse_down(button?: number = 0): boolean
- Returns whether a mouse button is held.
0= left,1= right,2= middle.
ui.get_color(name: string): (r: number, g: number, b: number, a: number)|nil
- Returns a menu theme color (
Scheme,WindowBg,Text,Border, …).
local r, g, b, a = secret.ui.get_color("Scheme")
ui.console_open(): boolean
- Returns a boolean value of the console being open.
ui.notify(text: string, type: number)
- Creates a new notification at the top left corner of the screen with the specified text and type.
- 0 = Default
- 1 = Warning
- 2 = Error
ui.is_keybind_active(keybind_name: string, absolute?: boolean = false): boolean
- Checks if a specified keybind is currently active/pressed.
- Only works with built-in cheat features, not Lua-specific keybinds.
-- check thirdperson with absolute=false (default) - returns true if in "always" mode or not bound
if secret.config.get("misc_thirdperson") and secret.ui.is_keybind_active("thirdperson") then
print("thirdperson is enabled (always mode or key not bound)")
end
-- check thirdperson with absolute=true - only returns true if key is physically pressed --> this is what the 'hotkeys' uses.
if secret.config.get("misc_thirdperson") and secret.ui.is_keybind_active("thirdperson", true) then
print("thirdperson key is currently being pressed")
end
Advanced script windows
This is the callback-based UI API for custom script windows. Use it when you want to build your own menu layout with Lua.
Quickstart
local ui = secret.ui
local window_id = "quickstart_window"
local state = { enabled = false }
local function render_window()
local changed
changed, state.enabled = ui.checkbox("enabled", state.enabled)
ui.tooltip("this is a quickstart tooltip")
end
if not ui.window_exists(window_id) then
ui.window_register(window_id, "quickstart", render_window, {
visible = true,
open = true,
size = { x = 320, y = 180 }
})
end
Window lifecycle
ui.window_register(id: string, title: string, callback: function, options?: table)
- Creates or replaces a script window and callback.
ui.window_bind_draw(id: string, callback: function)
- Replaces the draw callback for an already registered window.
- Useful when the window metadata was created earlier and you only need to update what it renders.
- The window must already exist (
ui.window_registerfirst).
ui.window_remove(id: string)
- Removes one script window.
ui.window_exists(id: string): boolean
- Checks if a window id is currently registered.
ui.window_clear_all()
- Removes all script windows created by Lua.
ui.window_set_visible(id: string, visible: boolean)
- Sets visibility.
ui.window_set_open(id: string, open: boolean)
- Sets open/closed state.
ui.window_get_open(id: string): boolean
- Gets open/closed state.
Window options, style, colors
ui.window_set_options(id: string, options: table)
- Updates options after registration.
- Full supported
optionsfields:
{
-- state
visible = true,
open = true,
-- glow/shadow toggle
glow = true, -- alias: shadow
shadow = true, -- alias of glow
-- transform
position = { x = 120, y = 120 }, -- or {120, 120}
size = { x = 420, y = 360 }, -- or {420, 360}
position_cond = 2, -- ImGuiCond number (optional)
size_cond = 2, -- ImGuiCond number (optional)
-- window flags
flags = 0, -- raw ImGuiWindowFlags number (optional)
no_title_bar = false,
no_resize = false,
no_move = false,
no_scrollbar = false,
no_scroll_with_mouse = false,
no_collapse = false,
always_auto_resize = false,
no_background = false,
no_saved_settings = false,
no_focus_on_appearing = false,
no_bring_to_front_on_focus = false
}
ui.window_set_style(id: string, style: table)
- Sets per-window style overrides (padding, spacing, rounding, border size, alignments).
- Full supported
stylekeys:
{
-- vec2
window_padding = { x = 13, y = 13 },
item_spacing = { x = 10, y = 10 },
item_inner_spacing = { x = 8, y = 8 },
window_title_align = { x = 0.0, y = 0.5 },
button_text_align = { x = 0.5, y = 0.5 },
selectable_text_align = { x = 0.0, y = 0.0 },
-- float
window_rounding = 6,
child_rounding = 6,
frame_rounding = 6,
popup_rounding = 6,
tab_rounding = 6,
scrollbar_rounding = 6,
grab_rounding = 6,
window_border_size = 1,
child_border_size = 1,
frame_border_size = 1,
popup_border_size = 1,
indent_spacing = 8,
scrollbar_size = 12,
grab_min_size = 10
}
ui.window_clear_style(id: string)
- Clears style overrides.
ui.window_set_color(id: string, color_name: string, color: table|r: number, g: number, b: number, a?: number)
- Sets one color override for a window.
ShadowandBorderShadowtarget the same outside glow color.- Full supported
color_namevalues:
{
"Text", "TextDisabled",
"WindowBg", "ChildBg", "PopupBg",
"Border", "BorderShadow", "Shadow",
"FrameBg", "FrameBgHovered", "FrameBgActive",
"TitleBg", "TitleBgActive", "TitleBgCollapsed",
"MenuBarBg",
"ScrollbarBg", "ScrollbarGrab", "ScrollbarGrabHovered", "ScrollbarGrabActive",
"CheckMark",
"SliderGrab", "SliderGrabActive",
"Button", "ButtonHovered", "ButtonActive",
"Header", "HeaderHovered", "HeaderActive",
"Separator", "SeparatorHovered", "SeparatorActive",
"ResizeGrip", "ResizeGripHovered", "ResizeGripActive",
"Tab", "TabHovered", "TabActive", "TabUnfocused", "TabUnfocusedActive",
"PlotLines", "PlotLinesHovered",
"PlotHistogram", "PlotHistogramHovered",
"TableHeaderBg", "TableBorderStrong", "TableBorderLight",
"TableRowBg", "TableRowBgAlt",
"TextSelectedBg",
"DragDropTarget",
"NavHighlight", "NavWindowingHighlight", "NavWindowingDimBg",
"ModalWindowDimBg",
"Scheme"
}
ui.window_clear_colors(id: string)
- Clears all window color overrides.
Widgets
ui.text(text: string)
- Draws text.
ui.text_colored(color: table, text: string)
- Draws colored text.
ui.button(label: string, width?: number, height?: number): boolean
- Draws a button. Returns
truewhen clicked.
ui.checkbox(label: string, value: boolean): (changed: boolean, value: boolean)
- Draws a checkbox.
ui.toggle(...) -- alias of ui.checkbox(...)
- Alias for
ui.checkbox.
ui.slider_float(label: string, value: number, min: number, max: number, format?: string): (changed: boolean, value: number)
- Float slider.
ui.slider_int(label: string, value: number, min: number, max: number, format?: string): (changed: boolean, value: number)
- Int slider.
ui.input_text(label: string, value: string, max_length?: number): (changed: boolean, value: string)
- Text input.
ui.combo(label: string, current_index_0_based: number, items: table): (changed: boolean, index_0_based: number)
- Combo using zero-based index.
ui.combo_simple(label: string, current_index_1_based: number, items: table): (changed: boolean, index_1_based: number)
- Combo using one-based index.
ui.tabs(id: string, current_index_1_based: number, labels: table): (changed: boolean, index_1_based: number)
- Tab selector.
ui.color_edit4(label: string, r: number, g: number, b: number, a: number, flags?: number): (changed: boolean, r: number, g: number, b: number, a: number)
- Color editor. Returns channels in 0-255.
ui.color_picker(label: string, color_or_channels..., picker_options?: table|number, layout_options?: table|boolean): (changed: boolean, color: table)
- Color picker helper.
ui.color_picker_inline(label: string, color_or_channels..., picker_options?: table|number, layout_options?: table|boolean): (changed: boolean, color: table)
- Inline color picker helper.
ui.hotkey(label: string, key: number, mode?: number, allow_mode?: boolean, inline?: boolean, spacing?: number, align_right?: boolean): (changed: boolean, key: number, mode: number)
- Hotkey widget.
ui.hotkey_inline(label: string, key: number, mode?: number, allow_mode?: boolean, spacing?: number): (changed: boolean, key: number, mode: number)
- Inline hotkey widget.
Helpers, layout, draw
Layout helpers
ui.tooltip(text: string): boolean
- Shows a tooltip if the previously rendered item is hovered.
ui.help_marker_inline(text: string, spacing?: number): boolean
- Draws inline
(?)and shows tooltip on hover.
ui.separator()
- Draws a horizontal separator line.
ui.spacing(amount?: number)
- Adds one or more spacing rows.
ui.same_line(offset?: number, spacing?: number)
- Places the next item on the same line.
ui.begin_group()
- Starts a group block.
ui.end_group()
- Ends a group block.
ui.begin_child(id: string, width: number, height: number, border?: boolean, flags?: number): boolean
- Begins a child/groupbox section. Returns opened state.
ui.end_child()
- Ends the current child/groupbox section.
Style stack helpers
ui.push_color(color_name: string, color: table)
- Pushes a temporary ImGui color.
ui.pop_color(count?: number)
- Pops one or more pushed colors.
ui.push_style_var(style_name: string, ...values)
- Pushes a temporary style var.
ui.pop_style_var(count?: number)
- Pops one or more pushed style vars.
Draw helpers
ui.draw_line(x1, y1, x2, y2, color, thickness?)
ui.draw_rect(x, y, w, h, color, rounding?, thickness?)
ui.draw_rect_filled(x, y, w, h, color, rounding?)
ui.draw_circle(x, y, radius, color, segments?, thickness?)
ui.draw_circle_filled(x, y, radius, color, segments?)
ui.draw_text(x, y, color, text)
- Draw-list primitives in current window space.
Cursor/window helpers
ui.get_cursor_pos(): (x: number, y: number)
ui.set_cursor_pos(x: number, y: number)
ui.get_window_size(): (w: number, h: number)
- Cursor/window helper functions.
example 1: simple (checkbox + slider)
local ui = secret.ui
local window_id = "example_simple_window"
local state = {
enabled = false,
power = 40
}
local function render_simple()
local changed_enabled
changed_enabled, state.enabled = ui.checkbox("enabled", state.enabled)
ui.tooltip("turn this on or off")
local changed_power
changed_power, state.power = ui.slider_int("power", state.power, 0, 100, "%d%%")
ui.tooltip("controls the power level")
end
if not ui.window_exists(window_id) then
ui.window_register(window_id, "simple menu", render_simple, {
visible = true,
open = true,
size = { x = 320, y = 180 },
no_collapse = true
})
end
example 2: tabs + checkboxes + colors + tooltips
local ui = secret.ui
local window_id = "example_tabs_window"
local state = {
left_tab = 1,
right_tab = 1,
legit = true,
visuals = true,
bhop = false,
accent = { r = 120, g = 170, b = 255, a = 255 },
glow = { r = 255, g = 120, b = 80, a = 160 },
mode = 1
}
local function render_tabs()
local window_w, window_h = ui.get_window_size()
local child_w = (window_w - 42) * 0.5
local left_open = ui.begin_child("left group##example2", child_w, 0, true)
if left_open then
local left_tab_changed
left_tab_changed, state.left_tab = ui.tabs("left_tabs", state.left_tab, { "main", "extra" })
ui.separator()
if state.left_tab == 1 then
local changed_legit
changed_legit, state.legit = ui.checkbox("legit enabled", state.legit)
ui.tooltip("main legit toggle")
local changed_visuals
changed_visuals, state.visuals = ui.checkbox("visuals enabled", state.visuals)
ui.tooltip("main visuals toggle")
else
local changed_bhop
changed_bhop, state.bhop = ui.checkbox("auto bhop", state.bhop)
ui.tooltip("example extra movement option")
local changed_mode
changed_mode, state.mode = ui.combo_simple("mode", state.mode, { "silent", "balanced", "aggressive" })
ui.help_marker_inline("switches behavior mode")
end
end
ui.end_child()
ui.same_line()
local right_open = ui.begin_child("right group##example2", child_w, 0, true)
if right_open then
local right_tab_changed
right_tab_changed, state.right_tab = ui.tabs("right_tabs", state.right_tab, { "colors", "glow" })
ui.separator()
if state.right_tab == 1 then
ui.text("accent")
local changed_accent
changed_accent, state.accent = ui.color_picker_inline("accent_inline", state.accent, {
compact = true,
use_inputs = false
}, {
inline = true,
spacing = 8
})
ui.tooltip("menu accent color")
if changed_accent then
ui.window_set_color(window_id, "Scheme", state.accent)
end
else
ui.text("shadow glow")
local changed_glow
changed_glow, state.glow = ui.color_picker_inline("shadow_inline", state.glow, {
compact = true,
use_inputs = false
}, {
inline = true,
spacing = 8
})
ui.tooltip("outside glow color")
if changed_glow then
ui.window_set_color(window_id, "Shadow", state.glow)
end
end
end
ui.end_child()
end
if not ui.window_exists(window_id) then
ui.window_register(window_id, "tabs menu", render_tabs, {
visible = true,
open = true,
size = { x = 430, y = 310 },
no_collapse = true
})
end