# Item Attribute Variables

{% content-ref url="/pages/amaXHi71QMt7RmrxlI8z" %}
[Variables Methods](/magic-pig-games/game-modules-4/module-documentation/items/itemobject.cs/item-attribute-variables/variables-methods.md)
{% endcontent-ref %}

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

Variables is a powerful feature for `GameItemObjects` to track values, and optionally update `ItemAttributes`.

Add a variable with the "Add" button.

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

By default, the value of this variable is a float between `0f` and `1f`.

Toggle on "Use Curve" to provide a curve with which to modify the `RangeValue`. Without a curve, the `RangeValue` will always be the same as the `Value`. In the example below, the `Value` is `0.5f`, but the `RangeValue` is `0.75f`.

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

You can customize the Min and Max values as well. Keep in mind that `RangeValue` will always be at `0f` when the `Value` is at `Min`, and `1f` when the Value is at `Max`.

<figure><img src="/files/XT5O2KlcE2UIymH7bYq8" alt=""><figcaption><p>In this example, the <code>Min</code> is 10, <code>Max</code> 100 and <code>Value</code> is 50. <code>RangeValue</code> is computed based on the <code>Min</code>, <code>Max</code>, and <code>Value</code>.</p></figcaption></figure>

You can also add one type of `ItemAttributes` as "Variable Attributes". The `ItemAttributes` of this `objectType` will be automatically added and removed based on the `RangeValue`. Based on the values set below, the "New" `ItemAttribute` would be added. The active one will be highlighted in green.

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

{% content-ref url="/pages/amaXHi71QMt7RmrxlI8z" %}
[Variables Methods](/magic-pig-games/game-modules-4/module-documentation/items/itemobject.cs/item-attribute-variables/variables-methods.md)
{% endcontent-ref %}


---

# 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://infinitypbr.gitbook.io/magic-pig-games/game-modules-4/module-documentation/items/itemobject.cs/item-attribute-variables.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.
