Skip to reading
Panels, Tabs & List Boxes

22. Delete the row the player chose

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

A fixed Item ID field is fine for a known row. To delete whichever row the player selected, read selected_clue in a script and pass that value as itemId. Do not assume typing $$selected_clue into an ID field will expand it.

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", "")
    )
    if chosen.is_empty():
        await SetVariable({
            "name": "clue_feedback",
            "value": "Choose a clue first."
        })
        return false
    await ListBoxDeleteItem({
        "guiId": "clues_page",
        "elementId": "clue_list",
        "itemId": chosen
    })
    await SetVariable({
        "name": "clue_feedback",
        "value": "Removed from the list: " + chosen
    })
    return true

1. Create a GDScript record with this source and Apply Changes.

2. Add a Delete chosen clue Button and set its Click event to run that script.

3. Choose letter and press the button. The row disappears and the selected ID clears because that row no longer exists.

This example is for the manual clue list. It is not an inventory removal script and does not delete an inventory definition.

Page 40 of 50Permalink
Go to page