Skip to content

LogicKeyValueStore

Vicious Squid edited this page Jul 8, 2026 · 5 revisions
LogicKeyValueStore LogicKeyValueStore

Stores up to 25 global key/value pairs that survive level changes

Allows events in one map to affect another map

Inputs

Input Parameter Format Description
SetValue "key=value" or "key" (value="1") Stores a key/value pair. Fires OnValueSet on success, OnStoreFull if at max capacity.
GetValue "key_name" Reads a key and fires OnValueRead with the value (or "<missing>").
ClearKey "key_name" Removes a single key. Fires OnKeyCleared if key existed.
ClearAll (none) Removes all keys. No output fired.
CopyFrom "other_store_name" Copies all keys from another LogicKeyValueStore by name. Fires OnValueSet.
Increment "key,amount" or "key" (amount=1) Treats value as integer and increments. Fires OnValueSet.
Decrement "key,amount" or "key" (amount=1) Treats value as integer and decrements. Fires OnValueSet.

Outputs

Output Parameter Description
OnValueSet "key=value" Fired when any key is successfully set or modified.
OnValueRead value or "<missing>" Fired by GetValue with the retrieved value.
OnKeyCleared "key_name" Fired when a key is removed via ClearKey.
OnStoreFull (none) Fired when trying to add beyond the 25 key limit.
OnKeyNotFound (none) Fired when GetValue targets a missing key.

Properties

Property Default Description
store_name entity name Unique identifier for cross-level persistence. Matching names share data across levels.
initial_data {} Designer-set key/value pairs loaded at level start (max 25 pairs).

Limits

Limit Value
Max key/value pairs 25
Value type String (cast to int for Increment/Decrement)
Persistence scope Class-level (survives level transitions within same process)

Example I/O Chain

[Trigger] OnTrigger ──► [LogicKeyValueStore_1] SetValue ──► "door_unlocked=1"
                                              │
                                              ▼
                                    [LogicKeyValueStore_1] OnValueSet ──► [Door] Unlock

Then later, another trigger can:

[Trigger] OnTrigger ──► [LogicKeyValueStore_1] GetValue ──► "door_unlocked"
                                              │
                                              ▼
                                    [LogicKeyValueStore_1] OnValueRead ──► [LogicGate] Trigger

Cross-Level Persistence

The LogicKeyValueStore uses a class-level _persistent_registry that survives level transitions. When a level loads a LogicKeyValueStore with a store_name that exists in the registry, it automatically inherits those values.

This allows:

  • Quest progress tracking across maps
  • Puzzle state persistence
  • Global flags and counters
  • Inventory-like systems

Clone this wiki locally