# Branching Scenario (H5P.BranchingScenario)

A story in which the learner's choices lead to different paths and endings: decisions, conversations, procedures.

- `branchingScenario.content` is the list of nodes, numbered from 0 in order; the scenario starts at node 0.
- A node's `type` is sub-content: text, an image, a video, a presentation, or a choice (H5P.BranchingQuestion). Every node that is not a choice says where it goes in `nextContentId`: the number of the next node, or `-1` to end the scenario there.
- A choice: `{ "library": "H5P.BranchingQuestion", "params": { "branchingQuestion": { "question": "…", "alternatives": [{ "text": "…", "nextContentId": 3 }] } } }`, each alternative leading to a node or an end.
- An end shows `endScreens[0]`; give a node `feedback` (`title`, `subtitle`, `endScreenScore`) for an ending of its own. More end screens are numbered `-2`, `-3`… in order, and a `nextContentId` can name one.
- The build refuses a link to a node that does not exist and a loop with no way out, and notes a node nothing leads to.

## Example

```json
{
  "type": "H5P.BranchingScenario",
  "params": {
    "branchingScenario": {
      "title": "Crossing the river",
      "startScreen": { "startScreenTitle": "Crossing the river", "startScreenSubtitle": "Choose a way across." },
      "content": [
        { "type": { "library": "H5P.AdvancedText", "params": { "text": "You reach a river after heavy rain. The water is high and fast." } }, "nextContentId": 1 },
        {
          "type": {
            "library": "H5P.BranchingQuestion",
            "params": { "branchingQuestion": { "question": "How do you cross?", "alternatives": [{ "text": "Wade across here", "nextContentId": 2 }, { "text": "Walk to the bridge", "nextContentId": 3 }] } }
          }
        },
        { "type": { "library": "H5P.AdvancedText", "params": { "text": "The current knocks you over. Never wade into fast water." } }, "nextContentId": -1, "feedback": { "title": "Swept away", "endScreenScore": 0 } },
        { "type": { "library": "H5P.AdvancedText", "params": { "text": "The bridge takes longer, and you cross safely." } }, "nextContentId": -1, "feedback": { "title": "Safely across", "endScreenScore": 1 } }
      ],
      "endScreens": [{ "endScreenTitle": "The end" }]
    }
  }
}
```

<!-- Generated by `h5p-author schema --markdown` from the pinned pack. Do not edit by hand. -->

## Fields of H5P.BranchingScenario 1.11

The example is `type` and `params` alone, and `params` holds the fields below. A source also names its own `title`, `language`, `license` and `authors`, all four required: the build refuses a source that leaves out any of them. The author's name and the licence are the user's: ask for what they have not given. For a name they skip, write the one you know them by, or "Unknown"; for a licence they skip, `U`.

- `branchingScenario` group — Branching Scenario Editor
  - `title` text, required — Title
  - `startScreen` group — Start screen
    - `startScreenTitle` html: strong em del code a — Course Title
    - `startScreenSubtitle` html: strong em del code a — Course Details
    - `startScreenImage` image file — Course image
    - `startScreenAltText` text — Image alternative text
  - `endScreens` list of — List of end screens
    - `endScreenTitle` html: strong em del code a — Title
    - `endScreenSubtitle` html: strong em del code a — Text
    - `endScreenImage` image file — Image
    - `endScreenScore` number = 0 — Score: The score will be sent to any LMS, LRS or any other connected service that receives scores from H5P for users who reach the default end scenario.
  - `content` list 1+ of, required — List of branching scenario content
    - `type` sub-content: H5P.BranchingQuestion | H5P.CoursePresentation | H5P.AdvancedText | H5P.Image | H5P.ImageHotspots | H5P.InteractiveVideo | H5P.Video, required
    - `showContentTitle` boolean — Show content title in view
    - `proceedButtonText` text = "Proceed" — Text for the proceed button (max length: 50 characters)
    - `forceContentFinished` one of "useBehavioural" | "enabled" | "disabled" = "useBehavioural" — Override require content finished: Override the individual settings for requiring the content to be finished before activating the "Proceed" button. Will not have any effect if the content doesn't …
    - `nextContentId` number, required, hidden in the editor
    - `feedback` group — Feedback
      - `title` html: strong em del code a — Feedback title
      - `subtitle` html: strong em del code a — Feedback text
      - `image` image file — Feedback image
      - `endScreenScore` number — Score for this scenario: The score will be sent to any LMS, LRS or any other connected service that receives scores from H5P for users who reach this scenario
    - `contentBehaviour` one of "useBehavioural" | "enabled" | "disabled" = "useBehavioural" — Navigate back: This will allow user to go back and see the previous content/question in the scenario.
  - `scoringOptionGroup` group — Scoring options
    - `scoringOption` one of "static-end-score" | "dynamic-score" | "no-score" = "no-score" — Scoring options: Select type of scoring.
    - `includeInteractionsScores` boolean = true; only when scoringOption is "dynamic-score" — Include scores from interactions within the Branching Scenario
  - `behaviour` group — Behavioural settings
    - `enableBackwardsNavigation` boolean = false — Navigate back
    - `forceContentFinished` boolean = false — Required to watch
    - `randomizeBranchingQuestions` boolean = false — Randomize Branching Questions

7 interface texts are left out: they come from the libraries' translations. `h5p-author schema H5P.BranchingScenario --all` lists them, for a source to set one.

<!-- End of the generated section. -->
