Main classes for game.

@author David Cooke
@version $Revision: 1.8 $

Format of game.xml

answer

Required Attributes

format
The text of the response. Parameter 0 is the person asking the question. Parameter 1 is the person answering the question. Parameter 2 is null, and is notionally the narrator. Use {ctx,1,0} for the direct speech of the answerer. Use {ctx,2,0} for the narrative voice. This attribute can be supplied as inline text

Optional Attributes

disableId
Id of a question to disable so it is no longer offered to the player.
enableId
Id of a question to enable so it is offered to the player.

Elements

change
A change to make to the model when this answer is used.

area

Specifies a group of locations within the game.

Required Attributes

id or prevId
a unique id for this location. This will be appended to the containing area's id. The prevId version can be used to refer to an already partially defined instance.

Optional Attributes

environment
one of the enum values of EnvEn. Used to control the initial part of the description string amongst other things. If this is not specified then the attribute of the containing area if any will be used.
recover
the fully qualified class name of the recovery class. If this is not specified then the attribute of the containing area if any will be used.

Elements

area
an area that is part of this area
location
a location that is part of this area

exit

Specifies an exit from one location to another, exits usually come in pairs.

Required Attributes

id or prevId
a unique id for this location. This will be appended to the containing area's id. The prevId version can be used to refer to an already partially defined instance.
direction
The direction of the exit from the player's position in the location. One of the enum values of DirEn
to
The id of the location reached by going through the exit. The location id can be relative to the containing area.
name
A short name for the exit
short
A short description of the exit. Appears in the description message: There is a wooden door to the North.
desc
A long description of the exit. Not currently used.

Optional Attributes

closeable
True if the exit can be closed, such as a door.
distance
Distance to the destination in metres. Use to calculate energy/time expended. Defaults to 1 if not defined.
hidden
True if the exit cannot be seen. The player will know about exits they have already used.
locked
True if the exit is locked.
open
True if the exit is open. Defaults to false. Does not apply to exits that are not closeable.

item

Specifies an item within the game.

Required Attributes

desc
Description of this item. If the description starts with a lower case letter the game will generate a preamble of "the name is" and add a stop at the end. If the description starts with "+" then the text here is appended to any existing description. This attribute can be supplied as inline text
name
The name of this item, one or two words long such as "chocolate donut". The last word must be the noun that can be made a plural. Appears in descriptions such as "You see a chocolate donut." Use the "measure" to set the natural quantity. So, setting name=trousers and measure=pair allows the game to construct "You buy three pairs of trousers."

Optional Attributes

adjectives
Comma separated list of adjectives that can be used to refer to this item. Adjectives may belong to a class introduced with a '$' for example "yellow$colour,bent,curved". Used for the text parser.
imageName
Unused. Intended to select an icon image.
known
Flag that indicates the player knows this object. Defaults to false.
lightSource
Flag indicating that this item emits light. Locations that are dark will require a light source for the player to see.
manipulated
Do not set. Intended to be used to compact saves.
measureArt
Flag indicating that the indefinite article ('a' or 'an') is needed when generating the name. True for cases like "part of a chicken".
measure
Name of the measure of this item. Measures are things like "pair", "bottle", "yard". Used when generating names and plurals like "two bottles of beer" (not "two bottle of beers").
multiple
Flag to indicate this item represents multiple items. Used in TextBuilder to generate appropriate endings.
names
Comma separated list of other names for this item. Used for the text parser.
noArt
Flag to indicate neither article should be used. Set for named people. Defaults to false.
pluralName
The plural of the name if this can't be computed using the rules of "Noun". There aren't many it can't handle, but there are some like sheep/sheep, woman/women.
respawn
Flag to indicate this object should respawn when the player is absent. Default false.
static
Flag to indicate that this item cannot be moved. Default false.
suppress
Flag to disable this item, effectively making it disappear to the rest of the game until cleared.
surface
Flag to indicate this item is a surface on to which other things can be put. If it isn't a surface, things go inside.
unique
Set by the container.

Elements

location

Specifies a location in the game.

Required Attributes

id or prevId
a unique id for this location. This will be appended to the containing area's id. The prevId version can be used to refer to an already partially defined instance.
name
very short name to identify this place on a button. Appears in the leave message: You leave the dell. Do not include any trailing punctuation.
short
short, 2 to 4 word, description of the place. Appears in the exit to message: There is a road, South, to the upper valley. Appears in the location header without the article: --Woodland dell--. Do not include any trailing punctuation.
desc
long description of the place shown when first entering and when a description is requested. The game generates the preamble You are standing in according to the character's pose and the environment. The game generates a description of all the exits that the character knows about and a list of all the items that the player can see. Avoid mentioning these in the desc text. End with a full stop. This attribute can be supplied as inline text

Optional Attributes

environment
one of the enum values of EnvEn. Used to control the initial part of the description string amongst other things. If this is not specified then the attribute of the containing area if any will be used.
recover
the fully qualified class name of the recovery class. If this is not specified then the attribute of the containing area if any will be used.

Elements

animal
an animal in this location
exit
an exit from this location
item
an item to be included in this location
multiexit
an exit that may lead to more than one place.
person
an person in this location

multiexit

Required Attributes

illogicalDest
Short description that replaces the target locations's short description when this multi exit is known. Appears in the description message: A twisty path goes North to the forest.

Optional Attributes

mode
Mode of exit selection. One of the enum values of MultiExitEn. Default is RAND.
lruDepth
Number of last used selections to exclude from the next RAND selection. Default is zero, so selection is random.
nextIdx
The index of the next (first) selection.

Elements

exit
One of the exits. At least one required.

question

Specifies a question and it's responses.

Required Attributes

id
the id for this question
question
The text of the question. Parameter 0 is the person asking the question. Parameter 1 is the person answering the question. Parameter 2 is null, and is notionally the narrator. Use {ctx,0,1} for the direct speech of the questioner. Use {ctx,2,0} for the narrative voice. This attribute can be supplied as inline text

Optional Attributes

condition
A GameTest condtion that must be true for the question to be offered to the player. Parameter 0 is the person asking the question. Parameter 1 is the person answering the question.
enabled
Flag that must be true to offer the question to the player. Defaults to true.
random
Flag to indicate a random answer should be used. Defaults to false.
short
Short text to put on the UI button when offering this question to the player.

Elements

answer
One of the answers.
sell
A response that sells something to the player.
work
A response where the player does work.

talk

Specifies questions and responses.

Elements

question
One of the questions.