StoryHarp
Product area
Help System
Index
Introduction
Definitions
Tutorials
Worlds
Agent
StoryHarp & IF
StoryHarp & Java
Registering
|
Examining one rule in detail
An adventure is made up of rules, which define commands and replies.
Audio Adventures (or "Audioventures" for short) consist of saying commands and listening to replies. All the possible commands and their replies are stored in a long list of rules.
Only some commands are active at once.
It would be a boring adventure if all the commands were active at the same
time. This would mean there would be too many commands to choose from, and the
available commands would be the same on every turn. Nothing could be accomplished
by the adventurer – because accomplishments result in new things that can be done, and new
replies that couldn't be heard before.
When a StoryHarp player says a command, the program matches what the player
said to a command in one or more of the available rules. The matching rule or
rules are used to determine what speech and sound to output in response. Matching
rules may also specify changes to the state of global variables in the adventure world. A rule’s command can be available or unavailable depending on the state of these
global variables and how they interact with other parts of the rule.
Rules have other parts that control the interaction.
Central to writing an interesting interactive adventure is controlling what
commands are active for each turn. To support this, in addition to a slot for a
command and a reply, every rule has four more slots. These are: context, move, requirements, and changes. A rule must always have a context and a command, but the other fields are
optional. Usually at least one of the other four rules is filled in. Every
StoryHarp adventure is simply a long list of these rules, each with only these six
fields. The complexity is all in how you put rules together to build an adventure.
A context can be a location, and a move changes the current location.
It is easiest to start thinking of context as a location and a move as a way
to change the current location (called the focused context). So for example, if you had a location called 'lobby', you might make a rule
with these values for the fields:
context
| command
| reply
| move
| lobby
| go over to the front desk
| You go over to the front desk.
| front desk
| This translates to:
When the player is in the lobby, saying “go over to the front desk” will move them to the front desk, with a reply of “You go over to the front desk.”
This command will only be available if the 'lobby' context is active – which typically means the lobby is the focused context. If you wanted a
command to 'go back to the lobby' from the front desk, you would set up a command
with 'front desk' as the context , 'lobby' as the move, and 'go back to the
lobby' as the command, like so:
context
| command
| reply
| move
| front desk
| go back to the lobby
| You go back to the lobby.
| lobby
| Here is an example of a complete rule.
Now we will examine a single rule in detail, looking at all the fields in the
rule.
Field
| Description
| Example
| context
| This is the most important variable that must be true for the command to be
available.
| by the fireplace in the hotel lobby
| command
| This is a phrase the adventurer may speak. All currently available commands
are told to the player when they say 'options'. If the phrase is prefaced by a
'$', as in '$swordfish', the player must guess the phrase, and it will be
described as 'an answer to a riddle' when options are requested.
| examine the vase
| reply
| This is something to be told to the player by the computer (via text-to-speech
software). The reply may include sounds, inserted as
{sound XXXX}, and music, inserted as
{music YYYY}.
| You find a slip of paper underneath the vase and put it in your pocket. {sound
paper rustle} Just then the hotel manager comes along, grabs you, and roughly
shoves you out the front door, saying "Really, enough poking around already.
You're disturbing the guests. Don't come back." {sound door slam} In the scuffle,
your glasses get stepped on and are crushed. {sound crushed glass}
| move
| The move is a context that will be set as the focused context after the user
says the command in this rule. This simulates moving from one location to
another.
(The more general explanation is: A move is a new primary variable to be set
to true. The previous primary variable is set to false. The primary variable is
called the focus, and usually is used as a context.)
| outside the hotel
| requirements
| This is list of variables (besides the context) that must be true or false for
the command to be available. A leading '~' means the variable must be false;
otherwise it must be true. All the listed variables must be in the correct state
for the command to be available.
| wearing glasses
~dizzy
| changes
| This is a list of other changes that make variables true or false. A leading
'~' means the variable will be set to false when the command in this rule is
said; otherwise the variable will be set to true (if not already true).
| holding the slip of paper
barred from the hotel
~wearing glasses
| Here is how the example rule will play out.
If you meet the requirements of standing by the fireplace in the hotel lobby, and are wearing glasses and are not dizzy, you can say the command "examine the vase". If you do so, then you get a
long reply with sound effects, a focus move to outside the hotel, and changes made so you are now holding the slip of paper, barred from the hotel, and not wearing glasses anymore. Each underlined item has an associated global variable of the same name.
Before you do this command, the focus will probably be by the fireplace in the hotel lobby. After the command, the focus will be outside the hotel. The crushing of the glasses is represented by setting wearing glasses to false. Having found the slip of paper is represented by setting holding the slip of paper to true.
See also:
Essential definitions
A simple example audioventure
Top twelve tips for authoring audioventures
|