SWAT TUTORIAL
Odds & Ends
To get the most from these tutorials, follow the instructions on downloading SWAT and joining the Authors' Guild before you begin. 

About Deikto - About Sappho - Boxes




About Deikto


Interactive storytelling is controlled by the language of interaction. The basic rules of interaction are these:
  • If you can't say it or hear it, you can't interact.
  • You can't say much with the devices we use for computer input (mouse, keyboard, etc.).
  • The obvious solution is language, but real language can't be done on a computer.
  • It's impossible because of the Sapir-Whorf hypothesis: our language mirrors the reality in which we live.
  • Reality is too big to fit inside a computer.
  • Ergo, we can't fit natural language (which mirrors reality) into the computer.
The solution is to create a toy language to go along with the toy reality of interactive storytelling.

Usually we define the toy reality, then try to make a language to fit it. That never works, because language is itself very complicated.  The Deikto solution is to make the language and the reality one and the same. Define the reality by defining the words of the language in terms of what they do.

Deikto (DEEK-toh) is a system for generating toy languages. It provides the grammar, the authors provides the words that plug into that grammar. Deikto appears in Storyteller, the software you used to play a storyworld. This is an example of a Deikto sentence:



Deikto is displayed to the player in Storyteller, the storyworld playing software. Each Deikto word has a form the author has to fill out to define it. The form depends on the type of word (Actor, Stage, Prop, etc). You will find these forms in SWAT, (StoryWorld Authoring Tool), the software you use to create a storyworld.



About Sappho

Sappho (SAF-foh) is the scripting language for Storytronics. It is the language you use in SWAT to fill out the forms for the Deikto words that the player sees. It's a very strange—and very powerful—scripting language, which is designed for writers and other storytelling professionals. It has many special features:
  • Syntax errors (saying something that confuses the language) are impossible.
  • Initialization errors (forgetting to set things up properly) are impossible.
  • Point-and-click editing (no typos to cause big trouble)
  • Argument prompts (when you need to fill in a blank, it tells you)
  • Scripting is organized in a tree structure (easier on the eyes)
  • Only legal Operators are made available at any given moment

Color-coded strong data typing:

                
Bright Red        Bounded or Unipolar Number
                Dark Red          Regular Number
                Blue                 Actor
                Green              Verb
                Black               Boolean
                
Magenta           Prop
                Orange             Stage
                Cyan                Event
                Blue-Green      Trait
                Purple              Quantifier
                Gray                Comment

This means that you can't accidently mix apples and oranges (or Props and Actors) because it won't let you put a Prop into a slot meant for an Actor, or vice versa. And the colors make it easy to tell the apples from the oranges.

There are about 600 Operators available—most are simple.  There is no "flow control" (branching, looping, or subroutines) as is common in most programming languages. (But there are implicit looping Operators.)  Run-time errors generate Poison—a system that protects you from minor scripting mistakes.


This is an example of a Sappho script:





Boxes

These are temporary places to store intermediate values; they save you time and tedium. There are three kinds of boxes:

Verb boxes
Role boxes
Global boxes

Boxes hold onto a particular item for you within a given scope. (For instance, a VerbActorBox will hold onto a specific Actor designation for use throughout the Verb's scripts. A RoleEventBox will hold onto a particular Event for use throughout that Role.) Boxes are useful when you have a fairly hairy script, or a script that involves HistoryBook lookups—e.g., PastActor of an Event with a bunch of different parameters, which you want to use multiple times.

There are Boxes for each of the major data types: Actors, Props, Stages, Events, and Verbs, as well as one BNumber box.

There are also four Global Box sets, again with one Box for each of the listed data types. These Boxes never forget the values you put into them; if you store something into a Box during one calculation, you can come back to it much later in a completely different calculation and it will still have that value in it.

Here is an example for how to use Boxes. It is not uncommon to use the same script for an Inclination and the Desirable script for a key WordSocket. Suppose you have a character who might want to run a con, and must choose both whom to run it on, and how likely he is to run the con, based on how gullible the intended target is. In a case like this, you can use a single script to both select a desired DirObject for the scam, and to determine how likely the ReactingActor is to run the con on that DirObject.

These two uses are confined to a single Roleconman—so the appropriate Box to use would be a RoleBox. In fact, in this example, you need two Roleboxes: one to pick the proposed DirObject, and another to give the BNumber corresponding to ReactingActor's perception of the DirObject's gullibility.

Before you can use a Box in your scripts, you must first fill it. You do this either in Consequences (for a VerbBox) or Emotional Reactions (for a RoleBox). Once it is filled, it becomes available throughout the rest of that Verb or Role, respectively.

In our example, the FillRoleActorBox script will look like this:

PickBestActor:
     true
     BInverse of:
          pGullible_Skeptical of:
               ReactingActor
               CandidateActor

This picks the Actor who the conman believes is the most gullible (note that to get the most gullible Actor, we needed to invert the Attribute).

Next you would choose FillRoleBNumberBox. The script would look like this:

pGullible_Skeptical of:
     ReactingActor
     RoleActorBox

This fills the Box with a BNumber corresponding to the conman's perception of his chosen target's gullibility.

Now you can use the following script for the Inclination to run the con:

RoleBNumberBox

For the DirObject Acceptable WordSocket, you would use:

AreSameActor:
     CandidateActor
     RoleActorBox

Ta-da! No muss, no fuss.

Where Boxes really save you time and effort is when you have a script that involves numerous Attributes, Lookups, and PickBests, which you use multiple times within a given Role or Verb. If you intend use a script more than once, use Boxes.

Here's how you know when to use a VerbBox versus a RoleBox. If the item you want to use in multiple places is confined to a single Role, you must use a Role box. If you intend to use that Box throughout the Verb, use a VerbBox.

Global Boxes work in a similar way to VerbBoxes and RoleBoxes, but they apply to the storyworld as a whole. Be forewarned: it is all too easy to get into trouble using Global Boxes. We strongly urge that, if you want to use any Global Boxes, you decide at the very beginning exactly what that Global Box will hold and never, ever change that in mid-stream. Otherwise, you'll get confused about the meaning of the Global Box and create monster headaches for yourself.



Previous tutorial (Group 5):  Engine Operation Detail