Index of every page on this site: llms.txt
All skills
jame581 avatar

/dialogue-system

@426e8ab
by Jan Mesarčjame581/godotprompter979 stars
63
Run it yourself

Use when building or replacing a dialogue system without an addon — branching data, conditions, and UI presentation. Not for extending an existing one

Use this Skill: https://skilld.dev/gh/jame581/godotprompter/dialogue-system

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencesvariable-interpolation.md

≈597 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Variable Interpolation

Reference for skills/dialogue-system/SKILL.md — replacing {player_name}-style placeholders in dialogue text. GDScript + C#.

← Back to SKILL.md


8. Variable Interpolation

Insert runtime values — player name, item names, quest counts — into dialogue text using String.format(). This works with both plain text and BBCode.

GDScript

# Simple format call — keys match {placeholder} tokens in the text.
var template := "Welcome back, {player_name}! You have {gold} gold."
var result   := template.format({
    "player_name": GameState.player_name,
    "gold":        GameState.gold,
})
# → "Welcome back, Aria! You have 120 gold."


# BBCode-safe — format() does not escape BBCode tags, so this works directly:
var bbcode_template := "[color=yellow]{item_name}[/color] has been added to your pack."
var bbcode_result   := bbcode_template.format({"item_name": acquired_item.name})
dialogue_text.text  = bbcode_result  # RichTextLabel renders both BBCode and substituted value.

Define a central _interpolate() helper in DialogueUI (or DialogueManager) so all text passes through the same substitution table:

func _interpolate(raw: String) -> String:
    return raw.format({
        "player_name": GameState.player_name,
        "chapter":     str(GameState.quest_stage("main")),
        # add more keys as the game grows
    })

C#

// String.Format with named placeholders is not built into C#.
// Use a simple regex-replace helper or a dedicated method:

private string Interpolate(string raw)
{
    return raw
        .Replace("{player_name}", GameState.Instance.PlayerName)
        .Replace("{gold}",        GameState.Instance.Gold.ToString());
}

// Or use a Dictionary for extensibility:
private string Interpolate(string raw)
{
    var vars = new System.Collections.Generic.Dictionary<string, string>
    {
        ["player_name"] = GameState.Instance.PlayerName,
        ["chapter"]     = GameState.Instance.QuestStage("main").ToString(),
    };

    foreach (var (key, value) in vars)
        raw = raw.Replace($"{{{key}}}", value);

    return raw;
}

For Godot's RichTextLabel, BBCode tags and {placeholder} tokens can coexist in the same string — format() only replaces {key} patterns and leaves all other characters untouched.


Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts7d3 checks · Risk SAFE
  • Gen Agent Trust Hub7d

    The skill provides a comprehensive implementation guide for a branching dialogue system in the Godot game engine. It includes data structures, management logic, and UI components using established engine patterns. Security analysis confirms the skill is safe, successfully utilizing Godot's built-in expression evaluation for game logic while following standard development practices.

  • Socket7d

    No alerts

  • Snyk7d

    Risk: LOW · No issues

Signed by skilld at 426e8ab. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 6 days ago.

Activeupdated last week

README badge

README badge for jame581/godotprompter/dialogue-system