-
Notifications
You must be signed in to change notification settings - Fork 9
LogicKeyValueStore
Vicious Squid edited this page Jul 8, 2026
·
5 revisions
Allows events in one map to affect another map
| 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. |
| 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. |
| 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). |
| 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) |
[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 ──► Unlock the door
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