> 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/learn-gpc/source-layout-and-global-namespace.md).

# Source layout and global namespace

A Live GPC file can contain these top-level forms:

* `define`
* `enum`
* `data(...)`
* typed `const` arrays, strings, images, and adaptive-trigger data
* `remap` and `unmap`
* global `int` variables and runtime arrays
* optional `init` section or sections
* one or more `main` sections
* `combo` / `fcombo` declarations
* user-created `function` declarations

Zen Studio Live accepts multiple `init` and `main` sections. The compiler merges all `init` sections into the one-time initialization phase and all `main` sections into the repeating main phase. Keeping one of each is normally clearer, but split sections in generated or assembled source are valid.

***

### Name spaces

GPC does not place every declared name in one namespace:

| Namespace/scope | Names in it                                                                   |
| --------------- | ----------------------------------------------------------------------------- |
| Data symbols    | Runtime variables and arrays, definitions, enum members, and const-data names |
| Functions       | User-created function names                                                   |
| Combos          | `combo` and `fcombo` names                                                    |
| Function-local  | The parameters declared by that function                                      |

Names must be unique within the namespace that owns them. A variable cannot reuse a definition, enum-member, or const-data name, but function names, combo names, and function parameters are resolved separately from that data-symbol namespace.

Language keywords and built-in **constants** are reserved. Declaring `main`, `if`, or a constant such as `PS5_CROSS` as your own name is a hard error.

Built-in **function** names are not reserved in the data-symbol namespace — `int set_val;` and `define set_val = 5;` both compile. What the compiler does reject is naming a *user-created function* after a built-in; that is reported as `GPC4001`.

{% hint style="warning" %}
Reusing a built-in function name for a variable or definition is legal, but strongly discouraged. Every compiler message about that name becomes ambiguous to read, and anyone maintaining the script later has to work out which `set_val` is meant.
{% endhint %}

***

Names are case-sensitive and follow this shape:

```
[A-Za-z_][A-Za-z0-9_]*
```

Prefer descriptive uppercase names for compile-time constants and lowercase snake case for runtime variables/functions. Even where separate namespaces technically allow the same spelling, distinct names make searches and compiler messages easier to understand.


---

# 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, and the optional `goal` query parameter:

```
GET https://guide.cronuszen.com/gpcscripting/gpc-script-guide/learn-gpc/source-layout-and-global-namespace.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
