menu

The menu namespace contains many functions related to User Interface functionality inside of your script!

Declaration:

namespace menu
{

    // remove an element by it's label
    void remove_element(string label);
    
    // toggle with a name and specified value
    toggle_t@ add_toggle(string label, bool value = false);
    
    // slider with a float value (uses C-style formatting, google "printf" formatting  for more information)
    slider_float_t@ add_slider_float(string label, float min, float max, float value = 0.f, string format_text = "%.1f")
    
    // slider with an integer value (uses C-style formatting, google "printf" formatting for more information)
    slider_int_t@ add_slider_int(string label, int min, int max, int value = 0.f, string format_text = "%d");
    
    // combo (aka. multi-select) with your specified elements
    combo_t@ add_combo(string label, array<string>@ combo_elements, int value = 0);
    
    // multi-combo, you will need to call set_value to set default values (if you wish)
    multi_combo_t@ add_multi_combo(string label, array<string>@ combo_elements);
    
    // specified text positioned automatically in the menu
    label_t@ add_label(string label);
    
    // separator between elements
    divider_t@ add_divider(string label);
    
    // seperator with a label in the middle
    label_divider_t@ add_label_divider(string label);
    
    // button that can be clicked to call your code
    button_t@ add_button(string label);
    
    // colorpicker to allow custom coloring of anything
    colorpicker_t@ add_colorpicker(string label);
    
    // add a keybind which allows you to easily create per-key functions
    keybind_t@ add_keybind(string label, bind_t&in bind);

}

Information:

All of these functions should be called in the beginning of your script, and not a callback! They will add/remove from the "elements" subtab in the "scripting" tab!

Examples:

Creating a button with a function that gets called on click which adds to a value

Creating a combo and a multi-combo and checking their values

Last updated

Was this helpful?