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
Product area
Help System
StoryHarp & IF
StoryHarp & Java

Advanced Tutorial -- Step 1: Add objects

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

About making objects in StoryHarp

StoryHarp can support objects by defining their behavior in the story using rules. These objects are not as general-purpose as objects in other interactive fiction authoring systems. For example, you can't easily create an object you can drop anywhere. You can do it, but it takes more rules than is usually practical. So, say good-bye to mazes where you have to drop things to map them. Of course, a lot of people don't like those kinds of mazes anyway. There is also no built-in support for inventory.

While it may seem that StoryHarp objects will therefore be boring, such is not the case. In practice, you usually only pick most things up in one place, and there is rarely a need to put things down. An example of a graphical adventure where inventory works this way is "The Neverhood". Often, you can only use an object in one or two ways in certain special situations. StoryHarp can accommodate all this and more.

How to make objects

Basically, you create a rule for every possible thing you can do with the object. These rules usually have requirements and changes to manage variables associated with the object. That is it in a nutshell, but in practice, there are several conventions you may want to adhere to.

Limitations on using objects

Before we proceed, just a reminder. You don't need lots of objects to have an interesting adventure. You can think of the process of adventuring as acquiring information.

For example, imagine a story world where you have to poke around to find people's email addresses so you can contact them, working your way to gaining the email address of "Mr. Big". You might have to go to all sorts of locations, talk to all sorts of characters, solve all sorts of puzzles and riddles, send all sorts of email, examine all sorts of objects, and even interact with all sorts of machinery, and never once have to pick up or put down an object. You progress in such a game could be measured purely by your acquisition of email addresses -- a form of information.

Also, remember that for an audio adventure operated by voice, the more options available at one time, the more likely the system will recognize the wrong one. So if you can potentially pick up and put down and use a dozen objects on every turn, the player may become frustrated as recognition accuracy degrades.

If you accept these limitations, we can proceed and make some neat objects, including a few you can pick up and put down in special circumstances.

Make an knife object

Let's create a jewel-encrusted knife which the player can find in the tree house in our forest. Let's let the knife be useable to cut the vine bridge. First, an observation. Really, if you found a jewel encrusted knife in the middle of the forest and picked it up, would you really drop it anywhere? No. You'd likely carry it everywhere until it was lost. At best, there might be a few sensible places to drop it, like where you found it, or in your trophy cabinet. So, for very little trouble, we can create a knife that does all the sensible things without all the bother of dealing with inventory. Remember, the emphasis in StoryHarp is on making the sensible things easy to do. The focus should be on your writing, and through that on maintaining a suspension of disbelief as the story progresses, rather than admonishing the player that they tried to do something that doesn't advance the plot or you did not anticipate. There is also nothing to keep you from adding all sorts of options that accomplish nothing significant, like trying to carve initials in a tree, or using the knife to trim toenails.

Here is a table with three rules needed to implement a minimal knife. You should try entering them into the StoryHarp world editor. These commands rely mainly on using one global variable: "holding knife". This knife can be picked up, carried around, and put back where it came from.

tree house
You see a jewel encrusted knife here.

~holding knife

tree house
take the knife
You take the knife. It fits your hand perfectly. It has a nice balance.

~holding knife
holding knife
tree house
drop the knife
You carefully put the knife back where you found it.
holding knife
~holding knife
Make the knife object do something interesting

Now let's make the knife a bit more interesting with four extra rules. With these, the knife can be inventoried, examined, used to demolish the bridge, and used to accidentally cut the player. We add the variable "accidentally cut" to record some information about how the knife was (mis)used.

holding knife
You are holding a jewel encrusted knife.

holding knife
examine the knife
It is jewel encrusted, mostly with emeralds. It has the initials "AS" carved on the bottom.

vine bridge
cut the bridge
Even though you're standing on it, you cut the bridge. You fall to the forest floor, surviving only because a pile of pine needles cushions your fall.

holding knife
bridge broken
carve initials into a tree
That would hurt the tree. You start to anyway, and wind up accidentally cutting yourself instead.

holding knife
~accidentally cut
accidentally cut
Make sure you have the knife when you cut the bridge

You should also add a requirement of "~holding knife" to the previously existing rule #13, which is what gets said when you try to cut the bridge without a knife. Without that extra requirement, you would get an extraneous message that you can't cut the bridge just before you actually do cut it. After you add that requirement, the result of saying "cut the vine bridge" will depend on whether or not you are holding the knife.

Add a change when the knife is examined

After using the story world for a while, it may seem lame to allow the player to "examine the knife" all the time. This also creates an extra command around for voice recognition confusion. Add a requirement of "~knife examined" and a change of "knife examined" on the "examine the knife" rule. Now the player can only examine the knife once. If they forget what the initials are, the player must consult the transcript for the results of the first examination.

Using contexts to determine knife states

These rules use "holding knife" both as a requirement and as a context. What does this mean? Any variable can be used as a context. StoryHarp makes no distinctions about variables used to represent being in a location and variables used to represent other information. You can have more than one context active at a time. In this sense, a context is simply an extra requirement field. We are taking advantage of this to add an "inventory" command and an "examine the knife" command, both of which are only available while the knife is held. Since these commands are available wherever the player is, as long as they are holding the knife, it make sense to think of "holding knife" as a context for these actions. It also provides a nice way to organize commands related to the object. However, it would probably never make sense to have a rule with a move to the
holding knife context.

The next section will develop this idea of multiple active contexts further, to create characters that follow the player around.

Test the story

Try picking up and putting down the knife and cutting the bridge in your story now.

Doing more with objects

All objects added to a StoryHarp audioventure will basically be implemented the same way the knife was. If you want to allow an object to be put down or picked up from a location, you will need to add rules in that location, and also add extra variables for each location to know the object is dropped there.

For example, if you wanted to allow the player to drop the knife in the forest, you would have to add a "knife in forest" variable. You would also have to modify the requirements and changes of the knife rules in the tree house to use something like "knife not in tree house". This would likely be a variable name with a "not" in it, since you want the knife to start out in the tree house. Alternatively, you could have the first rule in the world include a change the sets "knife in tree house" to true. You would require the relevant variable to have the correct state in any "look" rules describing the knife as being in a location.

Rather than go into detail with an example on this, if you absolutely want to do something like adding and dropping objects in multiple locations, ignoring these discouragements, you'll have to figure it out on your own. It's not that hard -- just redundant. You need to add a "look", "take object", and "drop object" command to every location where they can drop the object, along with a variable unique to that location.

By now, you should know enough to create most of the typical objects you will likely want to make. The next section covers creating characters that can interact with the player.


Forest map after adding knife object and prettying it up

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