Characters Tutorial

Take a look at the file on the left. It is a sample characters file. It's purpose is to describe the characters that make up your story. The first line, <?xml version="1.0"?>, is required and tells the browser that this is an XML file.

The next element is the characters element. Each characters file will have one and only one characters element. The closing characters tag is the very last tag in the file.

The next element is the character element. Each character in your story is contained within this element. You must specify a unique id for this element which you will use whenever you need to refer to a specific character. You need to include one character with an id of "player." This character represents the person who is playing your game. You must also specify the location of the character. The locationType may be "scene," "prop," or "character" although "scene" is really the only thing that makes sense. The locationId is the id of the scene (or prop or character) where the character is located. You must also specify the score for the player character. Normally the score will start at zero, but you can put in any value.

The next element is the longDescription property. This is a required property used to describe the character. Although you can change this property with the changeProperty action during the play of the game, the text here tends to be fairly static.

You may be wondering about all those [p]'s and [/p]'s in there. Well you can include html tags in your file, but to keep the browser from mis-interpreting the angle brackets as XML you need substitute square brackets. The game engine turns the stuff in the square brackets back into HTML when it displays the text on the screen. Yes, this means you can include graphics and just about anything else you can think of in your story.

Believe it or not these are the only elements requires for a character. The score element is an example of an author designed property. You can create as many properties as you need for your characters. Give the element a meaningful name and include a default value for it. Later you will act upon these properties based on the actions the player takes.

Of course the player won't be able to do much with the characters if you don't include any dialogs. The dialog element allows your story to respond to the player's input. After the <dialog>, you need to type in what the player's command is that you want to process. Only enter as much text as you need to make the player's command understandable. For example, key weather instead of give the weather report In this example we want to respond when the player asks for the weather.

Inside the dialog element you will see the when element. A series of conditions and actions go inside the when element. You can have as many when elements as you need in a dialog. Each when corresponds to a different set of conditions.

The condition elements describe under what conditions the actions will take place. You may include as many conditions as you need. Refer to the conditions and actions reference for a list of conditions that you can use.

After your conditions, you list your action elements. These are the elements that cause things to happen in your story. They move the player from scene to scene, change the properties of scenes, props, and characters, and display messages in the browser. See the conditions and actions reference for a list of actions you can perform.

Eventually you will want to put a handled element in the inside the when. This says that this particular dialog was able to totally handle the player's command. You can write more than one dialog to handle the player's input, but eventually one of those dialogs must mark the input as handled. Otherwise the dreaded "could not process command" message will appear in the browser.

You may also include monologs for your characters. Monologs work exactly like dialogs except that they execute before each of the player's turns instead of in response to the player's input. In this example a message displays if the player is at the top of the stalk.

Well, that's it for characters. Let move on to props.