The complete Check Answer script
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var entered: String = str(GetGUIElementProperty(
"register_panel", "answer_box", "text", ""
)).strip_edges().to_upper() if entered != "CLOCK":
await SetVariable({
"name": "feedback",
"value": "That is not the word. Try CLOCK."
})
return false if bool(Runtime.variables.get("register_open", false)):
return true
await SetVariable({"name": "register_open", "value": true})
await ChangeVariable({
"name": "score", "operation": "add", "value": 5
})
await SetVariable({
"name": "feedback",
"value": "The register unlocks. Five points earned."
})
await SetVariable({
"name": "objective",
"value": "Read the newly opened register."
})
await DisableGUIElement({
"guiId": "register_panel", "elementId": "answer_submit"
})
return trueUse answer_submit as the Check answer button's ID. The script disables that specific button after a correct answer. Replace these explicit IDs if your controls have different ones.
The flag is the reward guard. The disabled button is a useful presentation choice, but the flag still protects the reward if the script is called from somewhere else.
