> For the complete documentation index, see [llms.txt](https://halekio.gitbook.io/state-controller-block/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://halekio.gitbook.io/state-controller-block/readme.md).

# Introduction

***

<div align="center"><img src="/files/GRjDY6Ke2cnFhnbeJWIe" alt="" width="250"></div>

***

The **State Controller Block** is a programmable automation block that allows you to control the states nearby blocks using timers and conditions.

It works as a small, configurable state machine:\
you define states, assign durations, looping, and determine what triggers the state changes.

***

## What It Does

The block allows you to:

* Trigger block states in sequence
* Define how long each state remains active
* Enable or disable specific states
* Duplicate or reorder states in the loop
* Control which face and distance the block affects
* Add conditions such as player proximity, time of day, or block state checks

It is designed for building:

* Automatic doors and traps
* Timed mechanisms
* Conditional triggers
* Area-based automation
* Multi-stage sequences

***

## How It Works (Conceptually)

At its core, the State Controller Block:

1. Targets up to 6 blocks (one per face direction).
2. Affects blocks at a configurable distance.
3. Cycles through active states in order.
4. Applies each state for the defined duration.
5. Repeats infinitely or until iteration limits are met.
6. Optionally runs only when defined conditions are satisfied.

If conditions are not met, the state cycle pauses.

***

## Main Configuration Areas

The block has two configuration screens:

### Main Screen

Used to:

* Select target by face and distance
* Define states
* Set timing (minutes / seconds)
* Enable / disable states
* Duplicate or adjust ordering
* Set a "off" state

### Conditions Screen

Used to:

* Add environmental or player-based conditions
* Limit activation by range
* Restrict execution by time of day
* Require specific block states or nearby entities

Each screen is explained in detail in the next sections.

***

Continue to **Main Screen Configuration** to begin.


---

# 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://halekio.gitbook.io/state-controller-block/readme.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.
