Scenario

RMed edited this page Aug 30, 2013 · 1 revision

The scenario files are the ones that conform the main content of the stories. They basically have a title and as many paragraphs as needed (with some limitations) containing the text of the scenario, possible commands (should have a default command in case the player writes an command that does not exist) and the scenarios where these commands lead.

Sample code

<scenario>
    <!-- Basic data of the scenario -->
    <!-- Title of the scenario -->
    <title>Chapter 1: Prelude</title> 
    <!-- Paragraphs with text of the scenario. Paragraphs are separated by a blank line  -->
    <scenariop>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec id eleifend orci. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Nam leo arcu, blandit et sollicitudin at, consectetur in leo. Nulla vestibulum semper scelerisque. Phasellus ornare facilisis sollicitudin. Aliquam elementum nisi ut lectus semper eu.</scenariop>
    <scenariop>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sed orci vel nibh vehicula lobortis vel ut augue. Fusce massa arcu, congue id volutpat sit.</scenariop>

    <!-- List of actions -->
    <!-- Action input 'default' is executed when the player writes an unknown command. There can only be one of these -->
    <action input="default" type="text" content="That does not seem to be of any help here"></action>
        <!-- Type 'print' will print a message on screen -->

    <!-- Action input 'player' is executed when the input of the player is equal to any of the commands -->
    <action input="player" type="jump" content="Chapter_2">
        <!-- Type 'jump' will lead the player to another scenario, in this case, the destination file of the jump is Chapter_2 -->
        <command>onward</action>
        <command>forward</action>
    </action>
</scenario>

Markup details

Scenario data

title

Title of the scenario. Although it is better to show a title for each scenario, it may be left blank.

scenariop

Paragraph to be printed after the title. There is virtually no limit to the number of paragraphs that can be printed, however it is better to not have a very big number of paragraphs. Paragraphs should narrate concisely what is happening.

Actions and Commands

The actions need an input type to know whether it is a player action or default action:

  • default: indicates that the action is to be executed if the input from the player does not match any command. There can only be one command of this type.
  • player: indicates that the action is to be executed if the input from the player matches any of the action's commands.

Each command executes an action. For the time being, there are two types of actions:

  • text: will print a message on screen.
  • jump: will load the scenario specified in the markup. To specify a jump destination, you must write the filename of the scenario (note that capitalization is important!).

In both cases, the text to print and the destination of the jump are specified in the content tag.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.