Store and refresh character memories - part 1
Record ID: memory_tools. Global Script: on. Create one record containing Part 1 followed by Part 2. The scene-loaded and player-changed hooks refresh the displayed arrays after the relevant game event.
extends "res://scripts/runtime/script_base.gd"func on_scene_loaded(_context: Dictionary = {}) -> void:
await refresh()func on_player_changed(_context: Dictionary = {}) -> void:
await refresh()
await SetVariable({"name":"memory_topic", "value":""})func refresh() -> void:
var values: Dictionary = Runtime.get("variables")
var actor: String = ActivePlayer()
for kind: String in ["stm", "ltm"]:
var source: Array = values.get(kind + "_" + actor, [])
await SetVariable({"name":"memory_" + kind + "_active",
"value":source.duplicate(true)})Declare the character-specific arrays and the two active display arrays in the Variable Designer. Set the memory List Boxes to array sources, reading memory_stm_active and memory_ltm_active.
This is the first part of one script, not a separate record. Do not add a second extends line before Part 2.
