Store a radio choice as a stable value
For simple story logic, store one String such as relaxed, standard or challenging after reading the completed group. Do not store a translated caption as the identity of a difficulty mode.
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var mode: String = "relaxed"
if bool(GetGUIElementProperty(
"settings_lab", "radio_standard", "button_pressed", false
)):
mode = "standard"
elif bool(GetGUIElementProperty(
"settings_lab", "radio_challenging", "button_pressed", false
)):
mode = "challenging"
await SetVariable({
"name": "difficulty_mode", "value": mode
})
return trueCreate a String variable difficulty_mode with initial value relaxed. Run this script from Apply or Continue after the player has finished choosing.
Optional variable bindings on Radio Buttons write Booleans, just like a Check Box. If you use them, give each option its own Boolean, such as mode_relaxed, mode_standard and mode_challenging. Selecting a new option turns the previous one off.
Do not bind all three radio buttons to the same String variable. Their toggle notifications write true and false; they do not automatically write the radio button’s ID or caption.
