> For the complete documentation index, see [llms.txt](https://docs.nighty.one/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.nighty.one/custom-features-tab/my-values.md).

# My values

**My Values are like variables in programming** - but you don't need to know what that means, because the everyday version is simpler.

{% hint style="info" %}
**A My Value is a labelled box.** You write a name on the outside, and you put a piece of information inside. Later, whenever you write that name, you get back whatever's in the box.
{% endhint %}

Or think of it as a sticky note: the label is the name, what's written on it is the value.

You give your value a name, put something in it, and use it later in your expressions.

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

## Why bother

Three reasons, and they're all about saving yourself pain.

**You work something out once and reuse it.** If you need the same piece of information in four different actions, build it once into a My Value and point all four at that. No copying.

**You change it in one place.** Later you decide the greeting should use nicknames instead of usernames. With a My Value, you edit one box. Without one, you hunt through every action and hope you got them all.

## Creating one

My Values live **inside a** [**condition collection**](/custom-features-tab/conditions.md) - the **My Values** section at the top of it.

Each one needs three things:

| Field     | What it is                                                                                     |
| --------- | ---------------------------------------------------------------------------------------------- |
| **Name**  | The label on the box. How you'll refer to it later                                             |
| **Type**  | <p>What kind of thing it holds. Usually text<br>Nighty can usually detect it automatically</p> |
| **Value** | What goes in the box                                                                           |

The value isn't limited to fixed text you type. It can be built from the current event - the sender's name, the message's content, the server's name - the same way action details can. That's the point: you're capturing something *about this particular event* and giving it a name.

## When it gets filled in

A collection's My Values are worked out **before that collection's conditions are checked** - and they're worked out **whether or not the conditions end up passing**.

That means the same value is available everywhere downstream:

* The collection's own **conditions**
* Its **If met** actions
* Its **Otherwise** actions
* Every **later collection**
* The feature's **final actions**

So a My Value created in the first collection is still there at the very end of the run.

## Using one

You use a My Value in an expression by its name, written as **`my`**→**`your_name`**.

Anywhere you can drop in a live value - message text, a condition's comparison, a channel name - you can drop in a My Value.

## Changing one

{% hint style="info" %}
If you don't have the value to store yet, you can keep it empty and assign a value later, using the Edit My Value action.
{% endhint %}

Use the **Change one of My Values** action.

It takes the name of an existing value and gives it a new one.

{% stepper %}
{% step %}

## The value has to already exist

This action can only *change* a value, not create one.

Create it in a condition collection first - even if you just start it off empty.
{% endstep %}

{% step %}

## Only the contents change

The name and type stay exactly as you declared them. You're swapping what's in the box, not relabelling it.
{% endstep %}

{% step %}

## The new value is worked out fresh every time

If the new value is built from something live, it's recalculated at the moment the action runs - not reused from earlier.
{% endstep %}
{% endstepper %}

## How long they last

**One run.** That's it.

Every time your feature is triggered, its My Values start over from scratch. A value you set while handling one message is gone by the time the next message arrives.

That surprises people who expect a counter to keep counting. It won't.

| You want to…                           | Use                      |
| -------------------------------------- | ------------------------ |
| Hold onto something **during** one run | **My Values**            |
| Remember something **between** runs    | **Add ID Record** Action |
