Skip to reading
Eight Adventure Interface Workshops

Store and refresh character memories - part 1

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

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.

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func on_scene_loaded(_context: Dictionary = {}) -> void:
    await refresh()
Code example
func on_player_changed(_context: Dictionary = {}) -> void:
    await refresh()
    await SetVariable({"name":"memory_topic", "value":""})
Code example
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.

Page 101 of 119Permalink
Go to page