> For the complete documentation index, see [llms.txt](https://skript-mirror.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skript-mirror.gitbook.io/docs/1.x/advanced/computed-options.md).

# Computed Options

Skript's options section allows you to create snippets of text that are copied into other sections of your script. This is useful for static text, but does not work well for text that must be derived from dynamic sources, such as variables.

{% code title="Syntax" %}

```
option <option name>:
  get:
    # code, required
```

{% endcode %}

After the computed option is defined, it is accessible as `{@<option name>}` within the same script.

### Section `get`

Code in this section is executed as soon as it is parsed. This section must [return](/docs/1.x/advanced/custom-syntax/expressions.md#return) a value and must not contain delays.

## Using computed options for NMS imports

NMS packages include the Minecraft version, preventing code referencing NMS classes from working across versions. To get around this, computed options may be used to dynamically generate the proper NMS package.

{% code title="example.sk" %}

```
import: 
  org.bukkit.Bukkit 

option nms:
  get: 
    set {_nms version} to Bukkit.getServer().getClass().getPackage().getName().split("\.")[3]
    return "net.minecraft.server.%{_nms version}%"

import:
  {@nms}.MinecraftServer
  {@nms}.Item
```

{% endcode %}

{% hint style="warning" %}
While this code dynamically generates the appropriate NMS package prefix, it does not guarantee your code will work across versions! Be aware that classes, methods, and fields may change in incompatible ways across versions.
{% endhint %}


---

# 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://skript-mirror.gitbook.io/docs/1.x/advanced/computed-options.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.
