Skip to content

Latest commit

 

History

History
248 lines (173 loc) · 5.36 KB

menu.md

File metadata and controls

248 lines (173 loc) · 5.36 KB
description
Functions to add widgets into special group for scripts, and modulating variables (not a built-in cheat configuration variables! see config table for more info) of them

menu

🚧 API of this file is not finished yet and could be changed in any time

Enumerations

EKeyBindMode

Description: keybind variables switch mode

Indentifiers
KEYBIND_HOLD
KEYBIND_TOGGLE

Functions

IsOpened

Returns:

Type Description
bool true when cheat menu opened

Code:

local bIsMenuOpened = Menu.IsOpened()

Button

Parameters:

Name Type Description
szName string widget name
pCallback function callback on button click
szTooltip string tooltip when user hovers widget

Code:

Menu.Button("Test button", function()
    print("clicked!")
end, "Optional tooltip")

Checkbox

Parameters:

Name Type Description
szName string widget name
bDefault bool default widget variable value
szTooltip string tooltip when user hovers widget

Code:

Menu.Checkbox("Test checkbox", true, "Optional tooltip")

Toggle

Parameters:

Name Type Description
szName string widget name
bDefault bool default widget variable value
szTooltip string tooltip when user hovers widget

Code:

Menu.Toggle("Test toggle", true, "Optional tooltip")

HotKey

Parameters:

Name Type Description
szName string widget name
iDefualtKey int default hotkey widget key
iDefaultMode int default hotkey widget key mode
szTooltip string tooltip when user hovers widget

Code:

Menu.HotKey("Test hotkey", 0, EKeyBindMode.KEYBIND_TOGGLE, "Optional tooltip")

Combo

Parameters:

Name Type Description
szName string widget name
vecLabels table combo widget entries labels
nDefault int default combo widget selected label index
szTooltip string tooltip when user hovers widget

Code:

Menu.Combo("Test combo", { "First", "Second", "Third" }, 1, "Optional tooltip")

MultiCombo

Parameters:

Name Type Description
szName string widget name
vecLabels table multicombo widget entries labels
nDefault bitflag default multicombo widget selected labels flags
szTooltip string tooltip when user hovers widget

Code:

local bit = require("bit")
Menu.MultiCombo("Test combo", { "First", "Second", "Third" }, bit.bor(bit.lshift(1, 0), bit.lshift(2, 0)), "Optional tooltip")

SliderInt

Parameters:

Name Type Description
szName string widget name
iMinimal int sliderint widget minimal allowed variable value
iMaximal int sliderint widget maximal allowed variable value
iDefault int default sliderint widget variable value
szTooltip string tooltip when user hovers widget

Code:

Menu.SliderInt("Test slider int", -5, 10, 2)

SliderFloat

Parameters:

Name Type Description
szName string widget name
flMinimal float sliderfloat widget minimal allowed variable value
flMaximal float sliderfloat widget maximal allowed variable value
flDefault float default sliderfloat widget variable value
szTooltip string tooltip when user hovers widget

Code:

Menu.SliderFloat("Test slider float", 0.0, 100.0, 25.5)

ColorPicker

Parameters:

Name Type Description
szName string widget name
colDefault Color default color picker widget variable value
szTooltip string tooltip when user hovers widget

Code:

Menu.ColorPicker("Test color picker", Color.new())

Get

Parameters:

Name Type Description
szWidgetName string widget name to get value from
szScriptName string script name where located widget

Returns:

Type Description
any automatic value, for a checkbox/toggle, returns boolean. for a sliderint/combo/multicombo, returns an integer. for a sliderfloat, returns a float. for a hotkey, returns true if the hotkey is active. for a color picker, returns Color

Code:

Menu.ColorPicker("Test color picker", Color.new(150, 200, 50))
local colValue = Menu.Get("Test color picker", "qo0.lua")

Set

Parameters:

Name Type Description
szWidgetName string widget name to set value to
value any automatic value, for a checkbox/toggle - bool. for a sliderint/combo/multicombo - integer. for a sliderfloat - float. for a hotkey - bool. for a color picker - Color
szScriptName string script name where located widget

Code:

Menu.SliderFloat("Test Slider", 0.0, 100.0, 50.0)
Menu.Set("Test Slider", 1.5)

DeleteWidget

Parameters:

Name Type Description
szWidgetName string widget name to delete from menu

Code:

Menu.Checkbox("I'll be removed soon")
Menu.Button("Click to remove", function()
    Menu.DeleteWidget("I'll be removed soon")
end)