Skip to content

TriggerFiredEvent

An authored trigger fired.

Full documentation: TriggerFiredEvent. Wire type: trigger_fired.

Default visibility: referee

Message codes: session.trigger.fired

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who is allowed to see an event.\n\nEvery event has one of these two values, and the split exists because B/X keeps some rolls behind the\nreferee's screen. Filter a log on it before you show anything to a player, or call\n`GameSession.view`, which builds the player's and the referee's\nviews for you. A narrator playing referee reads both.\n\nThe values are the lowercase strings and they serialize into every event, so a renamed value is a\n`schema_version` bump.\n\nExamples:\n    ```python\n    from osrlib.core.events import DamageDealtEvent, HitPointsReportedEvent, Visibility\n\n    log = [\n        DamageDealtEvent(target_id=\"monster-0001\", amount=5),\n        HitPointsReportedEvent(target_id=\"monster-0001\", current_hp=2, max_hp=7),\n    ]\n    shown = [event.code for event in log if event.visibility is Visibility.PLAYER]\n    assert shown == [\"combat.damage.dealt\"]  # the goblin's remaining hit points stay hidden\n    ```",
      "enum": [
        "player",
        "referee"
      ],
      "title": "Visibility",
      "type": "string"
    }
  },
  "description": "An authored trigger fired.\n\nEmitted by `MarkTriggerFired`, every\ntime, including a repeat of a trigger that has fired before: the session records\nthat a trigger has fired at all, and these events are the record of each firing.\n\nIt's referee visibility, because which clause fired is the wiring behind the\ngame. A beat written for the table goes in the journal, and arrives as\n`JournalEntryAddedEvent` or as one\nof the quest events.",
  "properties": {
    "code": {
      "default": "session.trigger.fired",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.trigger.fired`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "referee",
      "description": "Referee visibility: trigger wiring is the game's own."
    },
    "event_type": {
      "const": "trigger_fired",
      "default": "trigger_fired",
      "title": "Event Type",
      "type": "string",
      "description": "The wire discriminator, `trigger_fired`."
    },
    "trigger_id": {
      "title": "Trigger Id",
      "type": "string",
      "description": "Which trigger fired, as the id the adventure gave it."
    },
    "narrative": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Narrative",
      "description": "The beat the author wrote for this firing, or `None`. Content rather than engine prose: the\ndefault formatter appends it after the templated line. It reaches a referee-visibility event,\nso put anything meant for the table in the journal instead."
    }
  },
  "required": [
    "trigger_id"
  ],
  "title": "TriggerFiredEvent",
  "type": "object"
}