Skip to reading
Save Games & Inventory

Read live slot information after an operation

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

A separate Read details button in the workshop runs this GDScript record. It reads the widget’s actual selected slot, then checks the current saved file information:

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    var slot_number: int = int(GetGUIElementProperty(
        "save_lab", "save_slots", "selected_slot", -1))
    if slot_number < 0:
        return false
    var info: Dictionary = Runtime.call(
        "get_save_slot_info", slot_number)
    var exists: bool = bool(info.get("exists", false))
    await SetVariable({
        "name": "selected_save_status",
        "value": "saved" if exists else "empty"
    })
    var caption: String = "This slot is empty."
    if exists:
        caption = "Saved: " + str(info.get("name", ""))
    await SetVariable({
        "name": "save_feedback", "value": caption
    })
    return exists

Assign this record to a Button and show $$save_feedback in a Label. This version deliberately distinguishes file existence from the earlier selection status. Add an autosave-specific caption if your menu needs one.

selected_slot is a readable widget property in this build. The fallback -1 means there is no selected slot. A command can still apply its first-slot fallback, so use your own guard when selection must be mandatory.

Page 64 of 96Permalink
Go to page