> For the complete documentation index, see [llms.txt](https://docs.pentafloat.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pentafloat.com/documentation/macros.md).

# Macros

A macro acts as shorthand for longer inputs. You could for example shorten a command with multiple parameters, into a concise macro that is faster to write.

## Creating macros[​](https://ghostlike.dk/docs/macros#creating-macros) <a href="#creating-macros" id="creating-macros"></a>

Create a macro with the `macro.add` command, followed by the input you want to substitute.\
Typing `macro.add loadmain 'scene.load MainScene'` results in a macro called #loadmain.\
When the input gets processed, #loadmain will automatically be replaced with `scene.load MainScene`.

{% hint style="info" %}
**Note**

Alternatively, macros can be created by typing #name, followed by the input.\
For example: `#loadmain 'scene.load MainScene'`
{% endhint %}

<details>

<summary>More macro usages</summary>

Let's say we have added a macro with `macro.add loadmain 'scene.load MainScene'`

```css
When typing '#loadmain'
It replaces your input with 'scene.load MainScene' 
```

Now let's say we add a macro like this: `macro.add emerald (0,208,98)`

```css
When typing 'fog.color #emerald'
It replaces your input with 'fog.color (0,208,98)'
```

Which makes your fog an objectively beautiful emerald green.

</details>

## Viewing current macros[​](https://ghostlike.dk/docs/macros#viewing-current-macros) <a href="#viewing-current-macros" id="viewing-current-macros"></a>

For an overview of all macros currently registered, simply execute the `macro.getall` command.

## Removing macros[​](https://ghostlike.dk/docs/macros#removing-macros) <a href="#removing-macros" id="removing-macros"></a>

To remove a macro, type `macro.remove` followed by the name of the macro, excluding the #.\
`macro.remove loadmain`\
You can also remove all registered macros with `macro.removeall`


---

# 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://docs.pentafloat.com/documentation/macros.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.
