# #define

### Description

\#define can be used in place of some common variables, but variables are a lot more flexible (eg. they can be changed within the macro) and are preferred. One good use of #define would be to enable or disable debugging information within a macro.

### Use

* **#define** *replaceme* replacement

Replaces all occurrences of *replaceme* with replacement throughout the macro. Example:

`#define Me charactername`

When the macro executes, all occurrences of "Me" will be replaced by "charactername". You can't use variables with

## define (since they execute before Sub Main).

### Example

```
#define DEBUG /echo
Sub Main
  /declare spell string local Complete Healing
  DEBUG I am casting ${spell}
  /call Cast "${spell}" gem1
/return
```

In this situation, DEBUG would be replaced by /echo before the macro started, thereby giving you some information on which spell you were casting.

Changing the **#define** line to this:

```
#define DEBUG /squelch /echo
```

Would effectively disable the debugging, since there would be no output to the screen.

Also useful for color coding your echoes. For example:

```
#define DEBUG "/echo \aw[\arDEBUG\aw]\ax"
Sub Main
  /declare spell string local Complete Healing
  DEBUG I am casting ${spell}
  /call Cast "${spell}" gem1
/return
```

Would allow your debug message to show up with a color coded prefix denoting that this message is from the debug side, and not a standard echo. In this case echoing out:

```
[DEBUG] I am casting Yaulp
```

Where the brackets are white, the word debug is red, and the text is your default color.

### See Also

* [Pound\_Commands](/macroquest/commands/macro-commands/macro-directives.md)
* [Macro\_Reference](/macroquest/documentation/macro-reference.md)


---

# Agent Instructions: 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://macroquest.gitbook.io/macroquest/commands/macro-commands/macro-directives/define.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.
