13. Make a Give one more hint Button
Create a GDScript record with ID next_hint. This version advances the machine topic by one answer each time and stops at three:
extends "res://scripts/runtime/script_base.gd"func run(_context: Dictionary = {}) -> Variant:
var values: Dictionary = Runtime.get("variables") as Dictionary
var unlocked: Dictionary = values.get("hintsUnlocked", {}) as Dictionary
var next_answer: int = mini(3, int(unlocked.get("machine", 0)) + 1)
await UnlockHint({
"topicId": "machine",
"answerNumber": next_answer
})
return true1. Apply Changes in the script editor.
2. Add a Button called Give one more hint.
3. In Events, set Click to run-visual-script and choose next_hint as the target.
4. Test repeated clicks in gameplay. Reopen the topic after each refresh to read the available answers.
hintsUnlocked stores the highest unlocked answer number for each topic. If machine is absent, the script treats the count as zero. Change both machine references for another topic, and replace 3 with that topic’s actual number of answers.
This Button deliberately gives help every time it is pressed. If you want a confirmation before revealing the final solution, add that choice to the surrounding GUI or script.
