Require a selected slot before saving
Record ID: strict_save. Global Script: off. This example is wired for mi_save / mi_saves. Replace those two IDs for another single-widget menu.
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var gui_id: String = "mi_save"
var widget_id: String = "mi_saves"
var slot: int = int(GetGUIElementProperty(
gui_id, widget_id, "selected_slot", -1))
if slot < 1:
return false
await SaveGameWidgetCommand({"guiId":gui_id,
"elementId":widget_id, "command":"save-slot", "slot":slot})
return trueThe ordinary selected-slot command can fall back to the first available slot if no explicit row was selected. This guard returns without saving instead. Create a load variant by changing save-slot to load-slot.
1. Put the wrapper on the Save Button instead of a direct save-selected action.
2. Run the menu without choosing a row. Nothing should be saved.
3. Select a row, run Save, name the position and confirm the result.
4. Keep Prompt for Name and Confirm Overwrite enabled on the widget.
For an even clearer interface, disable Save/Load until a valid row is selected and provide a short instruction. A silent guard is a safety net, not the whole user experience.
