Skip to content

SetFlag

Referee: set a session flag (content wiring: the lever opens the portcullis).

Full documentation: SetFlag. Wire type: set_flag.

Legal session modes: battle, encounter, exploring, game_over, town, victory

JSON Schema

{
  "description": "Referee: set a session flag (content wiring: the lever opens the portcullis).\n\nReferee commands are legal in every mode, terminal modes included. Flags\nserialize into saves. Game code and listeners read them back, and authored\ncontent reads them through\n`FlagEqualsCondition`, the gate on a\ndoor or stair that opens when the lever has been pulled.\n\nModes:\n    `town`, `exploring`, `encounter`, `battle`, `game_over`, `victory`\n\nRejections:\n    None.\n\nEvents:\n    `FlagSetEvent` with the key and value.",
  "properties": {
    "command_type": {
      "const": "set_flag",
      "default": "set_flag",
      "title": "Command Type",
      "type": "string",
      "description": "The wire discriminator. Each subclass fixes it to its own snake_case literal, like\n`\"move_party\"` or `\"open_door\"`, so you never set it yourself: constructing the subclass\ndoes. It's what `parse_command` and the\n`AnyCommand` union read to rebuild the right class\nfrom a serialized mapping, and it stays the same across releases."
    },
    "source": {
      "anyOf": [
        {
          "minLength": 1,
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Source",
      "description": "An annotation naming the authored object (a trigger or quest id) or the game\nsystem on whose behalf the command was issued. Execution never reads it: a stamped\ncommand does exactly what the same command unstamped does. It is logged and replayed\nwith the command, so the log alone answers \"why did this happen\". Absent is `None`,\nand the empty string is not a value."
    },
    "key": {
      "minLength": 1,
      "title": "Key",
      "type": "string",
      "description": "The flag's name, which is an open domain: any non-empty string a game wants, so a game's\nown systems set flags with their own names. Keep them stable, because the flag store\nserializes into saves and authored content reads these names back."
    },
    "value": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "boolean"
        }
      ],
      "title": "Value",
      "description": "What the flag is set to: a string, an integer, or a boolean. Setting a key that is already\nset replaces the old value. Authored content compares against this value through\n`FlagEqualsCondition`, so the door that opens\nwhen the lever has been pulled is a flag set here and a gate reading it there."
    }
  },
  "required": [
    "key",
    "value"
  ],
  "title": "SetFlag",
  "type": "object"
}