> For the complete documentation index, see [llms.txt](https://code-after-sex.gitbook.io/script-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://code-after-sex.gitbook.io/script-documentation/cas-radial-menu-v2/editing-the-menu.md).

# Editing the menu

How to add, remove and re-order slices in the RedM radial menu, item fields, sub-wheels, icons, and making a slot run your own command or event.

The menu is `Config.Menu` in **`config.lua`**. It is pushed to the UI every time the wheel opens, so a change is live after `restart cas-radialmenu`, there is nothing to rebuild.

`Config.Menu` is a list of **tabs**. Each tab holds one wheel's worth of items, and the tab bar across the wheel switches between them with **Q** and **E**.

```lua
Config.Menu = {
    {
        id = 'main', label = 'Main Menu', icon = 'inventory',
        items = {
            { id = 'inventory', label = 'Inventory', icon = 'inventory',
              hint = 'Everything you carry',
              event = 'vorp_inventory:OpenInv', requires = 'vorp' },
        },
    },
}
```

## Item fields

| Field      | What it does                                                                      |
| ---------- | --------------------------------------------------------------------------------- |
| `id`       | Sent back on select, and what `client/actions.lua` dispatches on. Must be unique. |
| `label`    | Shown in the hub in the middle of the wheel.                                      |
| `icon`     | A file name, no extension, from `ui/assets/icons`.                                |
| `hint`     | The small line under the label.                                                   |
| `disabled` | Greys the slice out and blocks selection.                                         |
| `children` | Opens a nested wheel instead of firing a selection.                               |

An item can also carry its own action, so nothing in `client/actions.lua` has to know about it:

| Field         | What it does                                                                                                                                                                 |
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `command`     | Runs a console command, `command = 'anim'`                                                                                                                                   |
| `event`       | Fires a client event, `event = 'vorp_inventory:OpenInv'`                                                                                                                     |
| `serverEvent` | Fires a server event                                                                                                                                                         |
| `args`        | A list passed along with `event` / `serverEvent`                                                                                                                             |
| `keepOpen`    | Leave the wheel up afterwards. **Off by default**, and usually correct: most of these open another resource's NUI, which has to happen after this wheel has let go of focus. |
| `requires`    | `'vorp'` or `'rsg'`, the item is dropped on the other framework                                                                                                              |
| `job`         | A list of job names; hidden from anyone not holding one. See [job gating](/script-documentation/cas-radial-menu-v2/configuration.md#job-gating).                             |

## Adding your own slice

Most of the time this is all you need:

```lua
{ id = 'myshop', label = 'Open Shop', icon = 'valuables',
  hint = 'Browse the general store',
  event = 'my-shop:open' },
```

Or a server event with arguments:

```lua
{ id = 'giveitem', label = 'Give Water', icon = 'provisions',
  serverEvent = 'my-resource:giveItem', args = { 'water', 1 } },
```

## Sub-wheels

Give an item `children` and it opens a wheel of its own instead of firing. Nesting is unlimited; **Backspace** or a right click steps back out.

```lua
{
    id = 'character', label = 'Character', icon = 'outfit',
    children = {
        { id = 'clothes', label = 'Clothes', icon = 'outfit', children = { } },
        { id = 'walk',    label = 'Walk',    icon = 'gait-casual', children = { } },
    },
},
```

## How many items fit

The ring is cut to the number of items on it: four items give a ring of four, not four lit slices and four dark ones. There are rings for **two through eight**.

Longer than eight and the wheel pages, scroll, or use the arrow keys, and each page is cut to what is actually on it, so the last page of a list of twelve is a full ring of four rather than a half empty ring of eight.

Fewer than two still uses the smallest ring, which leaves one slice dark.

## Icons

Icon names are the file names in `ui/assets/icons`, without the `.png`. Around 200 ship with the resource: inventory and clothing art, one per walk style, stance and pace, plus the job and general icons.

To see what is available, list that folder. To use your own, drop a PNG in and name it in `icon`. They are drawn as **masks**, the artwork should be in the alpha channel and the colour comes from the wheel, which is what keeps a custom icon looking like it belongs.

## The two tabs you do not author

`Favorites` and `History` fill themselves in. Leave their `items` empty in `Config.Menu`; anything put there is ignored. See [Configuration](/script-documentation/cas-radial-menu-v2/configuration.md#favourites-and-history).

## Adding slices from another resource

You do not have to edit `config.lua` for something that only exists at runtime, a slot that appears while the player is inside a shop, say. Use the [`AddItem` export](broken://pages/exports#additem-parentid-item).
