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

Intermediate Tutorial -- Step 4: Add requirements and changes

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

Prepare yourself

This step is somewhat tougher than the proceeding ones, so take a break, relax, catch up on your sleep, have a snack, put on your thinking cap, and when you are ready, go for it!

The bridge doesn
t break

The previous step included making an action that breaks the bridge. However, nothing prevents the player from destroying the bridge an endless number of times. Once the bridge is broken, the player should not be able to go onto it anymore.

Record the broken bridge as a change

We need to do two things to prevent this. The first is to record somehow that the bridge has been broken. This is done by adding a
change to the rule that breaks the bridge. A change sets a global variable to true or not true. (Saying "not true" is the same as saying "false".) Let's pick a descriptive name for our variable, like "bridge is broken".

To add the change, first select the rule #14 for "jump up and down" so it is in the rule editor panel. Then click in the changes list box near the top of it. A small floating edit box will appear with an editing cursor in it. If it does not appear, you may not be clicking high enough in the list box. You can also get the floating edit box by tabbing into the changes list box, then pressing the down arrow key to select the first item, then pressing Enter.

Type "bridge broken" in the floating edit box. Then press the Tab key to complete the change. If "bridge broken" is misspelled, double click on the phrase to get the floating edit box back, make the change, and then press Tab again. To modify an existing entry, you can also select it with a single mouse click and then press the Enter key. You can add as many different changes to a rule as you wish. In this case, we are adding only one.

Add a requirement for jumping on the bridge

Now the system will record that the bridge is broken when the command is done. However, we are still not doing anything with that information. To do so, we need to add some
requirements.

A requirement is a prerequisite for a command to be available. It specifies a global
variable whose state must match the state desired by the requirement. So, you can set up a requirement that needs a variable to be "true" for it to be satisfied. Or, you can set up a requirement that needs a variable to be "not true" for it to be satisfied.

All variables start out as "not true". Our new variable of "bridge broken" will start out as "not true" when the session starts. It will become true when the player does the "jump up and down" command. So we only want to allow the player to "go onto the vine bridge" when the
bridge broken variable is "not true".

We denote requirements for variables to be "not true" by putting a "~" (tilde) in front of them. The "~" is typically shift-"`", and is probably located in the upper left corner of your keyboard, above the Tab key. You can read a tilde as
not.

There are two rules to which we need to add a requirement of "~bridge broken" (you can say or read this as "not bridge broken"). From the map you can select one of the two commands labeled "go onto the vine bridge". These are rules #8 and #10. After you select one, click on the requirements list box in the same way you clicked in the changes box to get the floating edit box. Enter the phrase "~bridge broken" in the floating edit box, then press Tab. The requirements list box should now have a single requirement in it called "~bridge broken". You can add as many different requirements to a rule as you like. In this case, we are adding only one.

Change the required value

If you left out the "~", don't worry, we can put it back in. For fun, let's try turning the "~" on and off. To turn it off, left click the mouse on the line in the list box all the way to the left of the list box (or on the tilde). You need to have the mouse way over to the left inside the requirements list box or it won't work. The tilde should disappear. Click there again, in the space previously occupied by the tilde, and the tilde should reappear. Try it a few times. Make sure you leave the tilde on when you are done. What you are doing is changing the requirement from "not bridge broken" to "bridge broken" and back again. Of course, it doesn't make much sense to have a bridge that you can only go onto when it is broken, so it needs to be "~bridge broken" for everything to work properly.

Add the same requirement for walking on the bridge

Now, select the other rule with the command "go onto the vine bridge". Do the same thing with it, adding a requirement of "~bridge broken". If you want to try something different, enter "bridge broken" at first, press Tab, and then use the mouse to turn on the "~" (the "not" part), by clicking all the way over to the left. It is often easier to add the word and then the tilde, especially after you discover how to drag and drop to avoid typing.

Double-check the change and requirements

Check over your work at this point. Adding requirements and changes can be tricky. While StoryHarp tries to minimize the amount of programming skill required to make an adventure, there is still a little bit required, mostly to get tildes ("~"s) in the right place, and to make sure your requirements and changes all match up (they must have the same exact spelling).

Test it out

At this point, if everything is entered correctly, and your tildes are all where they should be, you should be able to jump on the bridge once. Then after you climb the tree again, the command "go onto the vine bridge" should no longer be available. Try it. Since there is no way to repair the bridge, you will need to reset the session to try it more than once. Another way to do this is by setting the value of "bridge broken" directly; this is handled in the upcoming step on debugging.

If things are working well enough, great! If it doesn't work, and you can keep going onto the vine bridge, perhaps you only set a requirement for one of the two rules (the one for the tree house). Or maybe the "change" got lost or was put into the incorrect rule. Use the map and table to look around the rules and check them out. If some other command vanishes after you jump up and down on the bridge, maybe you put a requirement in the wrong place.

If things aren't working, you may still have a misplaced tilde or a missing change or requirement. Review your work, and if the situation persists, stay calm. Upcoming steps will cover using the browser (a way to check your work) and debugging. If things aren't working, you may want to skip the next step on adding more requirements, go straight to the steps on browsing and debugging, then come back when it is working correctly.

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.