Skip to content

JournalEntryAddedEvent

A line of text was added to the session journal.

Full documentation: JournalEntryAddedEvent. Wire type: journal_entry_added.

Default visibility: player

Message codes: session.journal.entry_added

JSON Schema

{
  "$defs": {
    "Visibility": {
      "description": "Who may see an event: the players, or only the referee.\n\nEvery event has one of these values, because in B/X the referee makes some rolls behind a screen. Filter\na log on it before you show anything to a player, or call\n`GameSession.view`, which builds the players' view and the referee's\nview for you. A narrator that plays the referee reads every event.\n\nA serialized event contains the lowercase value. The values stay fixed within a `schema_version`, the version\nstamp of the saved format.\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": "A line of text was added to the session journal.\n\nEmitted by `AddJournalEntry`. The\njournal is the party's record of the adventure. Lines are added in order and never\nchanged, and the journal is part of what\n`GameSession.view` shows a player.\n\nQuest text also goes into the journal, but its quest event reports it, like\n`QuestActivatedEvent`, with no\n`JournalEntryAddedEvent`, so the players aren't shown the same line twice. Read the\nwhole journal from the view, and read these events to know when a line arrived.",
  "properties": {
    "code": {
      "default": "session.journal.entry_added",
      "title": "Code",
      "type": "string",
      "description": "The message code, always `session.journal.entry_added`."
    },
    "visibility": {
      "$ref": "#/$defs/Visibility",
      "default": "player",
      "description": "Player visibility: the journal is written for the players."
    },
    "event_type": {
      "const": "journal_entry_added",
      "default": "journal_entry_added",
      "title": "Event Type",
      "type": "string",
      "description": "The event type, `journal_entry_added`, which identifies this class in serialized form."
    },
    "text": {
      "title": "Text",
      "type": "string",
      "description": "The line as it was written. It came from your code or from the adventure, not from the\nengine."
    },
    "rounds": {
      "title": "Rounds",
      "type": "integer",
      "description": "Where the clock stood when the line was added, in rounds since the session began. The stored\njournal entry has the same number."
    }
  },
  "required": [
    "text",
    "rounds"
  ],
  "title": "JournalEntryAddedEvent",
  "type": "object"
}