Menu controller - part 2 of 2
func open(surface: String, from_surface: String = "pauseMenu") -> void:
return_surface = from_surface
Runtime.call("show_system_interface", surface)func back() -> void:
Runtime.call("show_system_interface", return_surface)func slot_command(gui_id: String, element_id: String, command: String) -> void:
var slot: int = int(GetGUIElementProperty(
gui_id, element_id, "selected_slot", -1))
if slot < 1:
await SetVariable({"name":"save_status", "value":"Choose a slot first."})
return
await SaveGameWidgetCommand({"guiId":gui_id, "elementId":element_id,
"command":command, "slot":slot})open remembers the parent system surface. back opens that parent. slot_command uses the selected slot on the actual widget and returns without saving/loading if no position has been chosen.
The message uses the save_status string variable. Put $$save_status in a Label on both Save and Load screens so the guard produces useful feedback.
The explicit command names are save-slot and load-slot. A selected-slot fallback is deliberately avoided here.
