> For the complete documentation index, see [llms.txt](https://guide.cronuszen.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.cronuszen.com/gpcscripting/gpc-script-guide/gpc-developer-guide/combo-section.md).

# Combo Section

A combo (short for combination) is a combination of pre-programmed instructions which are executed in sequence. Just like the `main` section, commands within a combo are performed in the order they are written.

You can run any code you can run in the `main` section within a combo, uch as calling functions or setting variables, although this is generally unnecessary and usually results in nothing more than a waste of stack memory and byte code space.

A combo is ideally suited to set the output of a button for a specific length of time which is done using the `wait` command, a command that is unique to combos and cannot be used elsewhere.

Just as with variables, a combo name can start with either an underscore (`_`) or a letter and can be followed by any combination of letters, digits, or underscores.

```gpc
main {
    if(event_press(XB1_A)) {
        combo_run(mycombo);
    }
    if(event_press(XB1_B)) {
        if(combo_running(mycombo)) {
            combo_stop(mycombo);
        }
    }
    if(event_press(XB1_X)) {
        combo_restart(mycombo);
    }
}

combo mycombo {
    set_val(XB1_A, 100);
    wait(200);
    wait(4000);
    set_val(XB1_B, 100);
    wait(200);
    wait(4000);
    set_val(XB1_X, 100);
    wait(200);
    wait(4000);
    set_val(XB1_Y, 100);
    wait(200);
    wait(4000);
    set_val(XB1_LB, 100);
    wait(200);
    wait(4000);
    call(mycombo2);
}

combo mycombo2 {
    set_val(XB1_RB, 100);
    wait(100);
    wait(2000);
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://guide.cronuszen.com/gpcscripting/gpc-script-guide/gpc-developer-guide/combo-section.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
