# Set a unique variable

<figure><img src="/files/9sGpOIFnSYaft6tkTXBy" alt=""><figcaption></figcaption></figure>

The Set a unique variable action block will allow you to create and store data for the commands execution, upon finishing the command cycle, the variable and all data stored inside will be deleted. This can be incredibly useful for storing IDs and using them after another [button ](/custom-commands-and-events/actions/legacy-reply-actions/send-a-message-with-attached-buttons/buttons.md)/ [menu option](/custom-commands-and-events/actions/legacy-reply-actions/send-a-message-with-a-select-menu/menu-option.md).

{% hint style="warning" %}
Unique variables are interaction specific and not command / event specific. This means that if you update the value of a unique variable after a button press, that value will be reflected only for actions below that set unique variable block. This means that when the button is clicked again, the previous value will be used as the starting value.

This behaviour, for example, makes it impossible to count button clicks with unique variables. Instead, you may use [Data Storage Variables](/custom-commands-and-events/data-storage.md).
{% endhint %}

## Name

This field is the name of the unique variable that you will be setting. It is highly recommended that you do not name the variable similar to a basic or existing variable such as `{user_id}`, as it could lead to bugs / errors.

<figure><img src="/files/0BHkGmcVa77leO1iHDUV" alt=""><figcaption></figcaption></figure>

## Value

The Value field is where you will store any value you wish for the commands execution. The value will be stored for the duration of the command and can be referenced in any block underneath the unique variable block. [Variables](/custom-commands-and-events/variables.md) can be used.

<figure><img src="/files/Hdm6ZEiO2bDvqBa8yG3d" alt=""><figcaption></figcaption></figure>


---

# 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://documentation.botghost.com/custom-commands-and-events/actions/other-actions/set-a-unique-variable.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.
