Menu
The Menu namespace provides APIs for creating, retrieving, and managing script menu options.
Interfaces
MenuOptionChange<T>
The MenuOptionChange interface describes the corresponding object shape exposed by the declarations.
indexMenuOption<T> - The index.oldValueT - The old value.newValueT - The new value.
Type Aliases
LocaleVariant"en" | "ru" | "cn" | "es"
The LocaleVariant type alias.
MenuOptionChangeCallback<T>(state: MenuOptionChange<T>) => void
The MenuOptionChangeCallback type alias.
Functions
GetOptionById(id: number)MenuOption<any> | null
Retrieves the option by id.
idnumber - The id.
Returned:
- MenuOption<any> | null - The matching object, or
nullif it is not available.
IsNewMenu()boolean
Checks whether it is new menu.
Returned:
- boolean - True if the condition is met, false otherwise.
GetLocale()LocaleVariant
Retrieves the locale.
Returned:
- LocaleVariant - The requested locale.
SetVisible(value: boolean)void
Sets the visible.
valueboolean - The value to set or use.
IsVisible()boolean
Checks whether it is visible.
Returned:
- boolean - True if the condition is met, false otherwise.
AddToggle(whereAt: string[], name: string, defaultValue: boolean)MenuOption<boolean>
Adds the toggle.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.defaultValueboolean - The default value.
Returned:
- MenuOption<boolean> - The result of the call.
AddSlider(whereAt: string[], name: string, minValue: number, maxValue: number, defaultValue: number, step?: number)MenuOption<number>
Adds the slider.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.minValuenumber - The min value.maxValuenumber - The max value.defaultValuenumber - The default value.stepnumber (optional) - The step.
Returned:
- MenuOption<number> - The result of the call.
AddInputBox(whereAt: string[], name: string, defaultValue: string)MenuOption<string>
Adds the input box.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.defaultValuestring - The default value.
Returned:
- MenuOption<string> - The result of the call.
AddComboBox(whereAt: string[], name: string, values: string[], defaultValueIndex: number)MenuOption<number>
Adds the combo box.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.valuesstring[] - The values to use.defaultValueIndexnumber - The default value index.
Returned:
- MenuOption<number> - The result of the call.
AddMultiComboBox(whereAt: string[], name: string, values: string[], defaultState: boolean[] | boolean)MenuOption<boolean[]>
Adds the multi combo box.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.valuesstring[] - The values to use.defaultStateboolean[] | boolean - The default state.
Returned:
- MenuOption<boolean[]> - The result of the call.
AddMultiSelect(whereAt: string[], name: string, images: string[], defaultState: boolean[] | boolean, reservedSlots?: number)MenuOption<boolean[]>
Adds the multi select.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.imagesstring[] - The images.defaultStateboolean[] | boolean - The default state.reservedSlotsnumber (optional) - The reserved slots.
Returned:
- MenuOption<boolean[]> - The result of the call.
AddPrioritySelect(whereAt: string[], name: string, images: string[], defaultState: boolean[] | boolean, reservedSlots?: number)MenuOption<number[]>
Adds the priority select.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.imagesstring[] - The images.defaultStateboolean[] | boolean - The default state.reservedSlotsnumber (optional) - The reserved slots.
Returned:
- MenuOption<number[]> - The result of the call.
AddColorPicker(whereAt: string[], name: string, color: Color)MenuOption<Color>
Adds the color picker.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.colorColor - The color value to use.
Returned:
- MenuOption<Color> - The result of the call.
AddColorPickerBlock(whereAt: string[], color: Color)MenuOption<Color>
Adds the color picker block.
whereAtstring[] - The menu path where the option should be added or resolved.colorColor - The color value to use.
Returned:
- MenuOption<Color> - The result of the call.
AddKeyBind(whereAt: string[], name: string, defaultKey: number)MenuOption<number>
Adds the key bind.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.defaultKeynumber - The default key.
Returned:
- MenuOption<number> - The result of the call.
AddToggleBlock(whereAt: string[], names: string[], state: boolean[] | boolean, vertical?: boolean)MenuOption<boolean[]>
Adds the toggle block.
whereAtstring[] - The menu path where the option should be added or resolved.namesstring[] - The names.stateboolean[] | boolean - The state.verticalboolean (optional) - The vertical.
Returned:
- MenuOption<boolean[]> - The result of the call.
AddHeroSelect(whereAt: string[], name: string, defaultValue: string[])MenuOption<string[]>
defaultValue is array of string of heroes names like npc_dota_hero_techies, npc_dota_hero_pudge
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.defaultValuestring[] - The default value.
Returned:
- MenuOption<string[]> - The result of the call.
AddButton(whereAt: string[], name: string, callback: () => void)MenuOption<void>
Adds the button.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.callback() => void - The callback.
Returned:
- MenuOption<void> - The result of the call.
AddLabel(whereAt: string[], name: string)MenuOption<void>
Adds the label.
whereAtstring[] - The menu path where the option should be added or resolved.namestring - The name.
Returned:
- MenuOption<void> - The result of the call.
SetPathLocale(whereAt: string[], locale: LocaleVariant, whereAtNew: string[])void
Sets the path locale.
whereAtstring[] - The menu path where the option should be added or resolved.localeLocaleVariant - The locale to use.whereAtNewstring[] - The where at new.
OpenFolder(path: string[])void
Opens the folder.
pathstring[] - The path.
HighlightOption(path: string[])void
Provides access to highlight option.
pathstring[] - The path.
GetFolder(whereAt: string[])MenuOption<void> | null
Retrieves the folder.
whereAtstring[] - The menu path where the option should be added or resolved.
Returned:
- MenuOption<void> | null - The matching object, or
nullif it is not available.
GetOption<T = any>(whereAt: string[])MenuOption<T> | null
Retrieves the option.
whereAtstring[] - The menu path where the option should be added or resolved.
Returned:
- MenuOption<T> | null - The matching object, or
nullif it is not available.
SetImage(whereAt: string[], imagePath: string)void
Sets the image.
whereAtstring[] - The menu path where the option should be added or resolved.imagePathstring - The image path.
OnOptionAdded(func: (option: MenuOption<any>) => void)void
Provides access to on option added.
func(option: MenuOption<any>) => void - The func.
IsKeyDownOnce(handle: MenuKeyBindHandler, checkInputCapture?: boolean)boolean
Checks whether the specified key was pressed once.
handleMenuKeyBindHandler - The handle.checkInputCaptureboolean (optional) - The check input capture.
WARNING
Deprecated. use option.IsKeyDownOnce instead
Returned:
- boolean - True if the condition is met, false otherwise.
IsKeyDown(handle: MenuKeyBindHandler, checkInputCapture?: boolean)boolean
Checks whether the specified key is currently held down.
handleMenuKeyBindHandler - The handle.checkInputCaptureboolean (optional) - The check input capture.
WARNING
Deprecated. use option.IsKeyDown instead
Returned:
- boolean - True if the condition is met, false otherwise.
GetValue<T>(handle: MenuOption<T>)T
Retrieves the specified console variable value.
handleMenuOption<T> - The handle.
WARNING
Deprecated. use option.GetValue instead
Returned:
- T - The requested value.
SetTipLocale(handle: MenuOptionHandler, locale: LocaleVariant, tip: string)void
Sets the tip locale.
handleMenuOptionHandler - The handle.localeLocaleVariant - The locale to use.tipstring - The tip.
WARNING
Deprecated. use option.SetTipLocale instead
GetFolderOptions(whereAt: string[])MenuOption<any>[] | null
Retrieves the folder options.
whereAtstring[] - The menu path where the option should be added or resolved.
WARNING
Deprecated. use option.GetChildrens instead
Returned:
- MenuOption<any>[] | null - The matching object, or
nullif it is not available.