Note: This page is no longer being maintained and is kept for archival purposes only.
For current information see our main page.
StoryHarp Kurtz-Fernhout Software
Developers of custom software and educational simulations.
Home ... News ... Products ... Download ... Order ... Support ... Consulting ... Company
StoryHarp
Product area
Help System
Index
Introduction
Definitions
Tutorials
Worlds
Agent
StoryHarp & IF
StoryHarp & Java
Registering

Advanced Tutorial -- Step 2: Add characters

-|----- Back | Next | Index

About characters

Interesting characters are probably the best way to liven up an adventure. Adding a character is easy; it is very similar to adding an object. The only difference is that you might want to allow the character to follow the player around. Characters cannot otherwise do things on their own, as an artificially intelligent creature might do. However, in practice, you can make it look like characters have been up to things behind the scenes by carefully crafting your commands.

This tutorial step will cover creating a mobile character. Note that characters do not have to be mobile. You can treat characters like locations. Just create a context for the character, and allow the player to move to and away from the character, just like any other location. Almost everything in this step could apply to either mobile or in-place characters.

Add a squirrel character

First, let's add a squirrel that follows our adventurer around the forest.

context
command
reply
requirements
changes
squirrel
look
You see a large tree squirrel following you around.



squirrel
pet the squirrel
The squirrel wags its bushy tail and stares at you with love in its eyes. Either that, or it's hungry.



squirrel
feed the big nut to the squirrel
The squirrel makes short work of the nut, and in gratitude, scampers off and returns with a small nut made of gold.

big nut
~big nut
golden nut
squirrel
kick the squirrel
The squirrel avoids the blow and scampers off.

~squirrel

As with the knife, whenever the squirrel context is true, these commands will be available. The "look" command will merge its reply in with the "look" for any location. You can test the squirrel by setting "squirrel" to true in the debugger.

Make the squirrel appear and disappear

To make the squirrel part of the story, however, somehow the squirrel context needs to get set to true in the first place. This could be done in the first rule of the adventure. You would need to add a change of "squirrel" to the first rule make that work. In this case, once the squirrel runs away, there is no way to get it back.

Alternatively, you could set "squirrel" to true whenever the adventurer climbs the tree. In this case, the squirrel will reappear when the tree is climbed even if it has been kicked before. More complicated logic (adding a "~squirrel kicked" requirement to all four rules) would prevent the reappearance if desired.

Let's consider the squirrel to be a "tree squirrel" and in that case should only follow the player around in the tree tops, vine bridge, and tree house. Add "squirrel" as a change when the tree is climbed. Add "~squirrel" in three command changes: when the forest is returned to by sliding down the tree, and in the two commands that break the bridge. They should then look like this (ignoring replies and requirements):

context
command
changes
forest
climb tree

squirrel
vine bridge
cut the bridge

~squirrel
vine bridge
jump up and down

~squirrel
tree top
slide down the tree
~squirrel

By the way, you can use the browser to determine the three rules that move to the forest by clicking on the Move button in the rule editor panel and picking "forest" from the first list in the browser (which is a list of all contexts that are moved to).

Add an interaction with the squirrel character

We don't yet have any way of getting a nut for the squirrel, or knowing we are holding a golden nut. So add these five rules to create two nut objects:

context
command
reply
requirements
changes
forest
look
You see a big nut on the ground.
~big nut
~golden nut


forest
take the big nut
You take the big nut.
~big nut
~golden nut

big nut

big nut
inventory
You are carrying a big nut.



golden nut
inventory
You are carrying a golden nut.



golden nut
examine the golden nut
This seems to be a missing part from some bolt on a mechanical device somewhere.



Note that we had to add an extra requirement of "~golden nut" to prevent the big nut from reappearing after it is fed to the squirrel. Now we have created a story which involves giving the squirrel something and getting something in return.

Also, any rules with a "look" command created that are after the squirrel rules in the list of rule will say their replies after the squirrel rules do. To control this, you may want to later move the squirrel rules lower in the table. This will make the squirrel
look reply appear later. This will only be an issue if the squirrel could appear in those other locations.

Test the story

Test the interaction with your squirrel using the player window.

About characters and variation

If we wanted the squirrel to appear only every third time the tree was climbed, we could create three "climb a tree" commands. Only one of these three rules would have a change to make "squirrel" true. We would use requirements and changes and other variables to make sure only one of these three commands was available in the forest at one time -- as a sequence. Adding a sequence of commands will be covered in a later step. The same kind of idea could be used to seemingly randomly affect the mood of a character, or what the character has been up to, and so forth.

The next step will describe how to add characters that converse with the player.

Home ... News ... Products ... Download ... Order ... Support ... Consulting ... Company
Updated: March 10, 1999. Questions/comments on site to webmaster@kurtz-fernhout.com.
Copyright © 1998, 1999 Paul D. Fernhout & Cynthia F. Kurtz.