# Defining Settings

Settings allow users to configure your script's behavior directly from the client UI. All settings must be created during script initialization.

### Setting Types

#### BooleanSetting

A simple toggle (on/off).

```js
const enabled = new BooleanSetting(script, "Enabled", "Whether the feature is active.", true);

// Reading the value
if (enabled.getValue()) {
    // do something
}
```

#### IntSetting

An integer value with a defined range.

```js
const delay = new IntSetting(script, "Delay", "Ticks between actions.", 5, 0, 20);

// With a slider step
const speed = new IntSetting(script, "Speed", "Movement speed multiplier.", 10, 0, 100, 5);

var value = delay.getValue(); // number
```

#### DoubleSetting

A decimal value with a defined range.

```javascript
const reach = new DoubleSetting(script, "Reach", "Attack reach in blocks.", 3.0, 1.0, 6.0);

// With a slider step
const factor = new DoubleSetting(script, "Factor", "Boost factor.", 1.5, 0.5, 5.0, 0.5);

var value = reach.getValue(); // number
```

#### ModeSetting

A dropdown that lets the user pick from a list of named modes.

```js
const mode = new ModeSetting(script, "Mode", "Which algorithm to use.", "Fast", ["Fast", "Silent", "Legit"]);

if (mode.is("Fast")) {
    // fast path
}

var current = mode.getValue(); // "Fast" | "Silent" | "Legit"
```

#### RangeSetting

A dual-handle slider representing a min/max range.

```js
const cps = new RangeSetting(script, "CPS", "Clicks per second range.", 8, 12, 1, 20, 1);

var min = cps.getMin();   // number
var max = cps.getMax();   // number
var val = cps.random();   // random value within the selected range
```

### Subgroups

Related settings can be organized under a `SubGroup` to keep the UI tidy.

```js
const rotations = new SubGroup("Rotations");

const smoothing = new BooleanSetting(rotations, "Smooth", "Smoothly rotate to targets.", true);
const rotSpeed  = new DoubleSetting(rotations, "Speed", "Max degrees per tick.", 8.0, 1.0, 180.0);
```

> Pass the `SubGroup` instance as the first argument instead of `script`.

### Conditional Visibility

You can hide settings dynamically based on the state of other settings using `.visible()`.

```js
const smooth = new BooleanSetting(script, "Smooth", "Enable smooth rotations.", true);
const speed  = new DoubleSetting(script, "Speed", "Rotation speed.", 8.0, 1.0, 180.0);

// Only show 'speed' when 'smooth' is enabled
speed.visible(() => smooth.getValue());
```


---

# 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://scripting.breeze.rip/defining_settings.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.
