Skip to reading
Panels, Tabs & List Boxes

13. Make the Review Button work

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Create a GDScript record named Review Clue with ID review_clue. Keep the script base line, replace the run function with this version, then Apply Changes. Create a String variable clue_feedback for the response text.

Code example
extends "res://scripts/runtime/script_base.gd"
Code example
func run(_context: Dictionary = {}) -> Variant:
    var chosen: String = str(
        Runtime.variables.get("selected_clue", "")
    )
    var response: String = "Choose a clue first."
    match chosen:
        "letter":
            response = "The keeper expected a visitor."
        "receipt":
            response = "The receipt lists a clock spring."
        "":
            pass
        _:
            response = "You examine the clue: " + chosen
    await SetVariable({
        "name": "clue_feedback", "value": response
    })
    return true

1. Add a Button on Clues Page with the caption Review clue.

2. In Events, set Click to run-visual-script and enter review_clue in Click Target. Despite its name, this behavior can run the GDScript record used here.

3. Add a separate Label whose Text is $$clue_feedback. Give it enough width and height for the response.

4. Run the game, select letter and press Review clue. Then repeat with receipt and with nothing selected.

Selecting a row does not automatically run this script. The separate button makes the order clear: choose first, confirm second.

Page 23 of 50Permalink
Go to page