Skip to main content

Code frameworks

Recipe: a choice with labels

Show friendly names for a choice while the rules keep the short value.

Goal

Let the player pick Lantern guard or Lantern scout, while rules and scenarios keep using Guard and Scout.

The change

schemas/keeper.json
    "calling": {
      "label": "Calling",
      "options": ["Guard", "Scout"],
      "defaultValue": "Guard",
      "optionLabels": { "Guard": "Lantern guard", "Scout": "Lantern scout" }
    }
  1. Line 11 The stored values. Rules and scenarios use these.
  2. Line 13 optionLabels maps each option to the text the player sees.

Labels belong to inputs that have options. Without options, the check refuses them.

declares optionLabels, but it has no options.

Test it

Scenarios still pass the option itself, such as Guard. Nothing else changes.

Next