Skip to reading
Eight Adventure Interface Workshops

Keep one logbook selection visible

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: book_selection. Global Script: on. The two page widgets have independent internal selections. This controller clears the other highlights when the shared selected_save value changes.

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
var previous: int = -999
Code example
func _process(_delta: float) -> void:
    if not is_instance_valid(Runtime):
        return
    var manager: Node = Runtime.get("authored_gui_manager")
    if not is_instance_valid(manager):
        return
    var values: Dictionary = Runtime.get("variables")
    var selected: int = int(values.get("selected_save", -1))
    if selected == previous:
        return
    previous = selected
    var nodes: Dictionary = manager.get("element_nodes")
    for page_id: String in ["curse_save", "curse_save2"]:
        for column: int in range(2):
            var id: String = page_id + "_saves_" + str(column)
            var widget: PCASaveGameWidget = nodes.get(id) as PCASaveGameWidget
            if not is_instance_valid(widget):
                continue
            if widget.selected_slot != selected:
                widget.selected_slot = -1
                widget.element["saveSelectedSlot"] = -1
                widget.refresh()

This refreshes the existing widget’s slots. It does not repeatedly change its source range or rebuild the complete authored inventory/save element.

Page 109 of 119Permalink
Go to page