Story Language (SLang)

This document is a language specification for SLang, a story scripting language. The procedural story-telling syntax for SLang is loosely based on a standard assembly language paradigm; stories are written as a series of instruction lines composed of opcodes and operands. SLang will also allow for dynamic and interactive story-telling by incorporating the syntax and object-oriented features of a Java-like language.

SLang will be used as both the input and output scripting language for stories being acted out by robotic dolls riding on the platforms of a Planar Manipulator Display (PMD). As an input script, SLang stories will direct the motions and interactions of the doll actors on the PMD. As an output script, a session of physically blocking a scene with the dolls on the PMD will produce an equivalent SLang script for reproducing that scene.

SLang is designed to be a teaching tool which will introduce children to computer programming and mathematical concepts. The premise being that children are motivated to learn these concepts by the excitement of writing and sharing their stories. SLang will also explore how students might collaboratively write stories using the PMD.

SLang "Hello World"

The following is a screen capture and code for a simple SLang Hello World script. In this story, the programmer, rather the director, wants an actor to move center stage, then look at and face the audience, and say "Hello World." The lines between story helloWorld and theEnd are examples of the assembly language based syntax for procedural story-telling. The last line, bracketed by curly braces, is a Java-like call to a default start() method which begins the story.

Note that the screen capture is of a PMD with Dolls simulation Java applet which will be available to faciliate the previewing and editing of SLang scripts.

 ##Simple SLang Hello World Story

 story helloWorld
         actor 0    movesTo    0,0              ## Actor 0 moves to center stage 
 then    actor 0    faces      camera           ## Actor 0 faces camera
                    looksAt    camera           ## Actor 0 looks at camera
                    says       ``Hello World''  ## Actor 0 says "Hello World"
            
 theEnd

 { start("helloWorld"); // Start "helloWorld" Story }

SLang Terminology

To faciliate the description of SLang, one should recognize the assembly language terms upong which some SLang terminology is based. In SLang, directions can be thought of as assembler instructions, actions as opcodes, and parameters as operands. For instance, in the third line of our Hello World example,
 actor 0    movesTo    0,0              ## Actor 0 moves to center stage 

is a Slang direction, movesTo is an action, and 0,0 are parameters for the action movesTo.

Story Sections

A SLang script is separated into sections called stories using the following syntax. At least one root story is required.


story <story_name>

   SLang Directions
          .
          .
          .

theEnd

In our Hello World example, there is one root story titled helloWorld.

SLang Direction Syntax

[sync] [actor] action parameters

[sync] This argument is an optional timing/synchronization keyword, when none is provide the synchronization is assumed to be while, i.e. parallel execution
[actor] Valid when the action pertains to an actor. Optional only if there exists a previous direction, within the enclosing story section, that specifies an actor or actor list. If so, the current direction line's action will be applied to the last actor or actor list provided. Otherwise, this argument is required to indicate the actor(s) to which the action should be applied.
action Required opcode specifying what the actor is to do, i.e. 'faces', 'looksAt', 'movesBy'.
parameters Required operands. Format is based upon the requested action

Comments

Comments are denoted by a ##. Any text begining with, and including, ## is ignored until a new line begins.
The first line of Hello World,
 ##Simple SLang Hello World Story 

is a comment.

SLang Direction Grammar Specification

   DIRECTION  := [SYNC] [ACTOR] ACTION PARAMETERS
   SYNC       := [ 'then' | 'and' | 'when' ]
   ACTOR      := 'actor' ( <integer> | EXPR ) [ ',' ( <integer> | EXPR ) ]* | 'everyone' |
                 'narrator'
   ACTION     := 'faces' | 'looksAt' | 'pauses' | 'movesBy' | 'movesTo' | 'says' | 'thinks' | 
                 'rightArm' | 'leftArm' 
   PARAMETERS := 'nothing', 'camera', QUOTE , COORDS, <integer>
   QUOTE      := ``<string>''
   COORDS     := (<integer> | EXPR) ',' (<integer> | EXPR)
   EXPR       := '{' <java_expression> '}'

Actor Blocking and Location Specification

Locations are specified as x,y coordinate pairs on 100x100 stage.
               x-axis
                  ^
                  |
                  |
               UPSTAGE
      USR /---------------\ USL
         /      (+50)      \
        /         |         \  
STAGE  / (-50)---(0)---(+50) \ -STAGE--> y-axis
RIGHT /           |           \ LEFT
     /            |            \
    /           (-50)           \
   /-----------------------------\
DSR           DOWNSTAGE           DSL 

Thus, the SLang statement:
 then     actor 0       movesTo 50,-50     ## Move actor 0 to (50,-50) 

directs actor zero to move to location (50,-50) which would be the downstage left corner.An actor can be moved absolutely using the moveTo action or relatively using the moveBy action. For example,

          actor 0     movesBy   -10,0      ## Move actor 0 downstage 10 

directs actor 0 to move downstage 10 units.

Actor Movements

SLang supports actor/doll movements such as head turning and gaze, arm motion, and body rotation. Head movements are made via the looksAt action. The parameter for looksAt is either another actor for the subject actor to look at, or one of two keywords: 1) nothing, which direct the subject actor to a look straight ahead, or 2) camera, which directs the subject actor to look out at the camera (i.e. the audience).

The following lookAt directions direct actors 0 and 1 to look at each other: The lookAt direction below directs actors 2,3, and 4 to look out at the audience:
 actor 0     looksAt   1 
 actor 1     looksAt   0 
 actor 2,3,4 looksAt   camera 

Creating Interactive Dynamic Stories with SLang

The next SLang script, Cutest One, introduces some of the interactive and dynamic functionality of SLang.