Scripting Basics
A Script is a tiny program that tells the Engine how to make things happen in your storyworld. Every Script starts with an Operator.  Some Operators take no arguments, others take one or two arguments, and some even have three, four, five, six, or more arguments.

Furthermore, Operators can take other Operators for arguments. So a Script is really just a bunch of Operators nested inside each other, just like a set of nested Russian Matroshka dolls.

Sappho is the Storytronics scripting language, and it includes about 1,000 Operators for you to choose from.  It has many special features to make scripting easier for the author.  (See About Sappho.)

A typical Script might read something like this: "Store (this answer) into the value for the Inclination." Of course, "this answer" could be a complicated group of Operators, but the basic structure is always the same: one Operator does one thing, but it can have several Operators inside it that it uses to do that one thing. And of course those subsidiary Operators can have subsidiary operators of their own, and on and on.  For a detailed discussion of how fast an Operator can get complicated, see

Right now we're just going to make a very simple script for each of our
Verbs.  We'll start with an Inclination Script.

Select the
Verb "punch" and it will appear with its single Role "punchee." The first Option for "punchee" is "punch" (if your screen shows "run away from," use the Options menu to choose "punch."  This Option, like every other, has an Inclination button. Click once on that Inclination button, and you'll see the default Inclination Script appear in the third (white) column to the right of the blue column. It's not much of a Script:

The title "Inclination" tells you that this is the
Inclination Script. Ignore the little "Script" button on the right edge for now.

The default
Inclination Script has a value of 0.0.  Click on that number.  Some new buttons appear above it, and some of the buttons along the right edge of the window activate. Those buttons along the right edge are actually menus. Click on one of those active menu buttons and a menu will pop up. Don't select anything from the menu just yet; to dismiss the menu, just click anywhere else.

Above the word "Inclination" is an octagonal button labeled "
BNumberConstant." Select that item and a dialog box appears:

This handsome fellow is our Fearless Leader, Chris Crawford, who is widely admired for his elegance and savoir faire. You can type in a number, so just type in .5 and click on the "OK" button. Ta-da! The value you typed in appears now in the Script. Your
Inclination Script asserts that the Inclination to choose this Option is 0.5.

That's a boring Inclination Script. It means that anybody and everybody will always have an Inclination of 0.5 to take the "punch" Option. It doesn't care who they are, how they feel, or anything else. Let's improve on it.

The red 0.5 should still be highlighted; if it isn't, click once on it to select it. From the menus along the right edge of the window, click on the "Mood" menu and you'll see five Operators. The middle one is "Fearful_Angry." That sounds pretty good for a situation like this; if an Actor is angry, he'll be more likely to "punch."  Select the "Fearful_Angry" Operator and it replaces the 0.5 in the Script. But now there's a new element as well:

Where'd that
ReactingActor Operator come from? It's what's called a default value. SWAT automatically inserts the most likely Operator in certain cases. In the great majority of Scripts, we have found that authors almost always enter ReactingActor in a spot like this. So we automatically put it there for you, saving you a little time. Isn't that sweet?

Of course, you don't have to accept our default value; if you want to put something else in there, you're welcome to do so. However, in this case, it's the correct value, because
ReactingActor always means "the Actor who has assumed this Role." Hence, this Script means that the punchee's Inclination to punch back is equal to how angry the punchee is.

Next we'll tackle a more complex Script, and one you'll probably be using a lot:  the AssumeRoleIf Script.

Previous tutorial:  Verbs                                                                      Next tutorial:  Scripting Exercise: AssumeRoleIf

Copyright notice
Russian Matroshka Dolls image by Khmelev Ltd. was taken from Wikimedia Commons, and is in the public domain.
Home     SiteMap     Feedback     FAQ     Press Room     Privacy Policy     Login