Send a logbook command to the correct page
Record ID: book_save. Global Script: off. Put it on each spread’s Save Button. Both page widgets must write their selected slot number into selected_save.
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var values: Dictionary = Runtime.get("variables")
var slot: int = int(values.get("selected_save", -1))
if slot < 1 or slot > 12:
return false
var page: int = 0 if slot <= 6 else 1
var column: int = 0 if (slot - 1) % 6 < 3 else 1
var gui_id: String = "curse_save" if page == 0 else "curse_save2"
await SaveGameWidgetCommand({"guiId":gui_id,
"elementId":gui_id+"_saves_"+str(column),
"command":"save-slot", "slot":slot})
return trueCreate book_load from the same source and change the command from save-slot to load-slot. Put that record on the Load Buttons. The explicit slot routes the command to the correct left/right widget on the correct spread.
On each page-change Button, first set selected_save to -1, then hide the old spread and show the destination. This guard makes a new selection necessary before the shared dispatcher can save or load.
For more than two spreads, extend the dispatcher and page setup together. Do not claim a slot range that the corresponding widget does not own.
