[API reference](https://jsprismarine.dev/api/index.md) / [@jsprismarine/prismarine](https://jsprismarine.dev/api/@jsprismarine/prismarine/index.md) / [scripting/DataDrivenScreens](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md) / VariableScreens

# Class: VariableScreens

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:302](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L302)

The screens of a client at protocol 2259 or later, whose data store holds variables rather than
properties: each value of a screen is a variable named `minecraft.<property>.<path>`, set by a
`Data Store Change` with its own update count. A change to a path sends that variable again with
the count one higher, and a screen the client reports closed has every variable removed. BDS
takes a client's write only when its count is higher than the variable's.

## Implements

- [`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens)

## Constructors

### Constructor

> **new VariableScreens**(`send`): `VariableScreens`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:311](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L311)

#### Parameters

##### send

(`packet`) => `void`

Sends one packet to the client.

#### Returns

`VariableScreens`

## Methods

### close()

> **close**(`formId`): `void`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:333](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L333)

Asks the client to close one screen.

#### Parameters

##### formId

`number`

#### Returns

`void`

#### Implementation of

[`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens).[`close`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#close)

***

### closed()

> **closed**(`formId`): `boolean`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:352](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L352)

Takes a client's report that a screen closed and clears its property; false when it was not open.

#### Parameters

##### formId

`number`

#### Returns

`boolean`

#### Implementation of

[`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens).[`closed`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#closed)

***

### show()

> **show**(`formId`, `screen`): `void`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:314](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L314)

Sets the screen's property, sends the updates that follow it, and opens the screen.

#### Parameters

##### formId

`number`

##### screen

[`DataDrivenScreen`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/world/index.md#datadrivenscreen)

#### Returns

`void`

#### Implementation of

[`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens).[`show`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#show)

***

### update()

> **update**(`property`, `__namedParameters`): `void`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:327](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L327)

Changes one path of a property the client was sent.

#### Parameters

##### property

`string`

##### \_\_namedParameters

[`DataDrivenPathValue`](https://jsprismarine.dev/api/@jsprismarine/script-host/host/world/index.md#datadrivenpathvalue)

#### Returns

`void`

#### Implementation of

[`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens).[`update`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#update)

***

### written()

> **written**(`__namedParameters`): [`DataDrivenWrite`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenwrite) \| `undefined`

Defined in: [packages/prismarine/src/scripting/DataDrivenScreens.ts:338](https://github.com/JSPrismarine/JSPrismarine/blob/e928b08f56694af6821b757ce6b196faebd3199c/packages/prismarine/src/scripting/DataDrivenScreens.ts#L338)

Takes a client's write to a path of an open screen's property; undefined when it names none or is stale.

#### Parameters

##### \_\_namedParameters

###### update

[`DataStoreUpdate`](https://jsprismarine.dev/api/@jsprismarine/protocol/classes/DataStoreUpdate.md) \| `null` = `...`

`Update` before protocol 2259, the single data store update the client applies. `null` from 2259.

###### variableUpdate

[`DataStoreVariableUpdate`](https://jsprismarine.dev/api/@jsprismarine/protocol/index.md#datastorevariableupdate) \| `null`

`Update` from protocol 2259, keyed by variable name. `null` before 2259.

#### Returns

[`DataDrivenWrite`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenwrite) \| `undefined`

#### Implementation of

[`DataDrivenScreens`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#datadrivenscreens).[`written`](https://jsprismarine.dev/api/@jsprismarine/prismarine/scripting/DataDrivenScreens/index.md#written)
