FEWS Game script configuration
What |
script_config.xml |
---|---|
Description |
Configuration of a script in the FEWS Game |
schema location |
script_config.xsd |
In a script configuration, the start and end time, and events for the script are specified. A script is a directory in the scenario/script database in which files relevant for that script are collected, including the script configuration file. For more information, see scenario/script database.
Schema definition overview
The global structure of the XML-schema for the script configuration is as follows:
The Title
key is an optional identifier for the script.
The start and end date/time for the script have to be specified using attributes date
and time
in the format YYYY-MM-DD
and hh:mm:ss
, respectively.
The configuration of events (or Stories
) and the ForecastTable
for a script are explained below.
Stories
In the section Stories
of the script configuration, an arbitrary number of stories can be specified.
Two types of stories can be specified:
Inbox
is optional and may be specified only once. In the inbox storyline you define the messages that appear in the inbox, which can be selected by the user.Story
is optional and can be specified an arbitrary number of times. Each story corresponds to a "Communication" button in the user interface that can be activated by the user. The content of story buttons can be dynamic, i.e. different events may be triggered by pushing the story button at different times.
Each story must have a title by specifying the Title
key (but the title for the inbox is optional). This title will be used as the title of the story button. The title can be different for various languages, using the attribute lang
. If the language attribute for Title
is specified and it corresponds to the preferred language in the application configuration, then this title is used in the script. If no language attribute is found that corresponds to the preferred language, then the default Title
for which no language attribute was specified will be used. For example:
<Story> <Title lang="NL">Telefoongesprek</Title> <Title lang="GE">Anruf</Title> <Title>Telephone call</Title> </Story>
Frames
A story may consist of an arbitrary number of frames by specifying the Frame
key according to the following schema:
The Title
of a frame in the inbox will be used in the list of actions that the user can invoke from the inbox drop-down menu. The title of a frame in a regular story will be used as the name of the button that the user can activate. As explained above, the title can be different for various languages.
The Start
and Stop
keys indicate the time window in which the frame of a story is active. For a frame in the inbox this means that the associated event is available in the inbox within the time window defined by the start and stop time. For a frame in a regular story, the associated event will be executed if the user pushes the story button between the start and stop time. The Start
and Stop
keys have attributes date
and time
following the format YYYY-MM-DD
and hh:mm:ss
, respectively. Both the Start
and Stop
keys are optional. If these are not specified, then these default to the start and end time of the script, respectively.
The Popup
key is a flag indicating whether or not to show a pop-up window at the start of the frame. For a frame belonging to the inbox this means that the associated event is executed. For a frame of a regular story, a message dialog appears informing the user that new content is available for a story, which can trigger the user to activate the relevant story button.
A Condition
can be added to a story (or inbox) frame; the associated event will only be executed if this condition is fulfilled. For now, the only supported condition is one based on a forecast published by the user. A condition must be specified according to:
Type
must be equal to "Forecast",ColumnId
is a reference to a column in the forecast table (see below), usually a parameter,RowId
is a reference to a row in the forecast table (see below), usually a location,Operator
is one of "lt" (less than), "gt" (greater than), "le" (less than or equal to), or "ge" (greater than or equal to), andValue
is the reference value to compare to.
An example in which a condition is used:
<Frame> <Title>condition example</Title> <Start date="2008-03-13" time="00:01:00"/> <Stop date="2008-03-13" time="00:02:00"/> <Popup>true</Popup> <Condition> <Type>Forecast</Type> <ColumnId>water_level</ColumnId> <RowId>Lowestoft</RowId> <Operator>ge</Operator> <Value>300</Value> </Condition> <File>emergency_telephone_call.txt</File> </Frame>
An event can be associated with a story frame by specifying the File
key. Depending on the file type, a suitable application is started for displaying the file (e.g. a pdf-file is displayed in Adobe Reader and the contents of a txt-file is displayed in a message dialog window). The File
-key has an optional language attribute lang
that behaves the same as for the Title
keys.
Forecast Table
The contents of the forecast table can be configured using the ForecastTable
key. The schema for this section is as follows:
The time zone can be specified with the TimeZone
key; for now, only "GMT" is supported.
Using the Header
key, the headers of columns in the forecast table can be specified. A column can be added with the the Column
key. The value of this key is used as the name in the header of that column. For each column an id
attribute must be specified. Furthermore, the following optional attributes may be specified for a column:
unit
: a string containing the unit for the column (e.g. "cm" for a water level),isEditable
: a flag with valuetrue
orfalse
indicating whether the column is editable for the user (e.g. the user can enter the forecast in this column),isExport
: a flag with valuetrue
orfalse
indicating whether the column must be exported to file if the forecast is published (editable columns are exported by default),exportName
: a string containing the name that must be used for exporting the column to file.
For example, the header section in the forecast table may look like:
<Header> <Column id="station">station</Column> <Column id="date">date</Column> <Column id="time">time</Column> <Column id="astro_level" isExport="true" exportName="H.tidal.astronomic" unit="cm">astronomical water level</Column> <Column id="water_level" isEditable="true" exportName="H.tidal.peak" unit="cm">water level</Column> <Column id="discharge" isEditable="true" exportName="Q" unit="m^3/s">discharge</Column> </Header>
Rows can be added to the forecast table by specifying the Row
key. The number of rows is arbitrary. For each row, an identifier must be specified using the id
attribute. Content for a row is added using the Cell
key, where each cell must correspond to a column in the header. This can be achieved with the columnId
attribute of the Row
key. For example:
<Row id="Vlissingen"> <Cell columnId="station">Vlissingen</Cell> <Cell columnId="date">12 Mar</Cell> <Cell columnId="time">17h16</Cell> <Cell columnId="astro_level">237</Cell> </Row>
Example
A complete example of a script configuration is given here:
<?xml version="1.0" encoding="UTF-8"?> <Script xmlns="http://localhost" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://localhost ../../xml-schemas/script_config.xsd"> <Title>storm surge March 12</Title> <Start date="2008-03-12" time="04:00:00"/> <Stop date="2008-03-12" time="18:00:00"/> <NextEventButton>true</NextEventButton> <Stories> <Inbox> <Title>inbox</Title> <Frame> <Title lang="NL">Start zitting</Title> <Title lang="EN">Session start</Title> <Start date="2008-03-12" time="04:00:05"/> <Popup>true</Popup> <File lang="NL">start_zitting_NL.txt</File> <File lang="EN">start_zitting_EN.txt</File> </Frame> <Frame> <Title lang="NL">KNMI weeranalyse 12 maart, 0:00 uur</Title> <Title lang="EN">KNMI analysis March 12, 12:00 midnight</Title> <Start date="2008-03-12" time="04:00:05"/> <Popup>false</Popup> <File lang="NL">weerkaart_12maart_00uur.pdf</File> <File lang="EN">weerkaart_12maart_00uur.pdf</File> </Frame> <Frame> <Title lang="NL">KNMI run 11 maart, 12:00 uur</Title> <Title lang="EN">KNMI run March 11, 12:00 noon</Title> <Start date="2008-03-12" time="04:00:05"/> <Popup>false</Popup> <File lang="NL">windveld_11maart_12uur.pdf</File> <File lang="EN">windveld_11maart_12uur.pdf</File> </Frame> <Frame> <Title lang="NL">Opdracht 1</Title> <Title lang="EN">Exercise 1</Title> <Start date="2008-03-12" time="04:11:00"/> <Popup>true</Popup> <File lang="NL">opdracht1_NL.txt</File> <File lang="EN">opdracht1_EN.txt</File> </Frame> </Inbox> <Story> <Title>KNMI</Title> <Frame> <Title lang="NL">Telefoon</Title> <Title lang="EN">Telephone call</Title> <Start date="2008-03-12" time="04:10:00"/> <Popup>true</Popup> <File lang="NL">telefoon_knmi_bericht1_NL.txt</File> <File lang="EN">telefoon_knmi_bericht1_EN.txt</File> </Frame> </Story> <Story> <Title>HMCZ</Title> <Frame> <Title lang="NL">Telefoon</Title> <Title lang="EN">Telephone call</Title> <Start date="2008-03-12" time="04:11:00"/> <Popup>false</Popup> <File lang="NL">telefoon_hmcz_bericht1_NL.txt</File> <File lang="EN">telefoon_hmcz_bericht1_EN.txt</File> </Frame> </Story> <Story> <Title>HMCN</Title> <Frame> <Title lang="NL">Telefoon</Title> <Title lang="EN">Telephone call</Title> <Start date="2008-03-12" time="05:36:00"/> <Popup>false</Popup> <File lang="NL">telefoon_hmcn_bericht1_NL.txt</File> <File lang="EN">telefoon_hmcn_bericht1_EN.txt</File> </Frame> </Story> </Stories> <ForecastTable> <TimeZone>GMT</TimeZone> <Header> <Column id="sector">sector</Column> <Column id="station">station</Column> <Column id="astro_date">datum</Column> <Column id="astro_time">tijd astro HW</Column> <Column id="astro_level" unit="cm" isExport="true" exportName="H.tidal.astronomic">astro waterstand</Column> <Column id="svsd_forecast" unit="cm" isEditable="true" exportName="H.tidal.peak">SVSD verwachting</Column> </Header> <Row id="Vlissingen"> <Cell columnId="sector">Schelde</Cell> <Cell columnId="station">Vlissingen</Cell> <Cell columnId="astro_date">12 maart</Cell> <Cell columnId="astro_time">17:16</Cell> <Cell columnId="astro_level">237</Cell> </Row> <Row id="HoekVanHolland"> <Cell columnId="sector">West Holland</Cell> <Cell columnId="station">Hoek van Holland</Cell> <Cell columnId="astro_date">12 maart</Cell> <Cell columnId="astro_time">18:01</Cell> <Cell columnId="astro_level">122</Cell> </Row> </ForecastTable> </Script>