Programming in Morphic


Scripting with Players - The "User-Scripting" Style

The second style of programming is rather more informal, more like "scratch programming", somewhat comparable to what we Smalltalkers do when we use a Workspace to construct and evaluate various lines of code for some exploration or calculation in Smalltalk, and also comparable to the kind of scripting done by users of systems like HyperCard and HyperStudio, etc.

In the User-Scripting style, you construct surface graphics by directly assembling standard Morphic parts -- e.g. Rectangles, Images, Joysticks, etc., by dragging them from a Parts Bin and arranging them as desired, and then you add user-defined state and behavior by adding instance variables and writing methods for "Players" who represent the individual morphs you wish to script.

The user thus does not directly subclass any particular kind of Morph, but rather she *assembles* Morphs and gives them special state and behavior by associating them with "Players", which are the fundamental user-scriptable object types for User Scripting. (The basic hookup is that every Morph can have, optionally, a Player as it's "costumee", and every Player has an associated Morph that it "wears" as its "costume". Player itself is a class with lots of capability but very little instance state; user-defined Players are all implemented as compact,single-instance subclasses of Player.)

Blanket Disclaimer and Warning

In Squeak 2.0 we offer only a very early take on User Scripting. It has many rough edges, consumes lots of memory, can leave garbage around that will bloat your image, It is tempting to dwell at length on "Disclaimers" about User Scripting, but we shall resist, beyond saying: this is early work, preliminary, much in flux, with many bugs, many inconsistencies, significant gaps in design, and much that definitely will be changing soon. If you wish to play with this stuff anyway, please do so in a spirit of high adventure, and be sure to protect yourself by doing your exploring in a "throw-away" copy of your image, not in something you intend to save and build on. These are very early days!

Live Examples Coming Later

In due course, we will be placing on the Squeak web site some "live examples" of use of "Player Scripting". Eventually, we expect that full, interactive, mutlimedia-based Squeak tutorials, constructed entirely within the User Scripting domain, will be downloadable from the Web and will be immediately active and usable.Technical limitations have kept us from doing that now, and space considerations have kept us from implanting live examples in this release image. Good advice for the moment (except for the most adventurous) is to wait until those live examples are available on the net. They should make it much easier to absorb the basics of user-scripting, without having to wade through so much prose.