Getting Started with Scripting


Other things you need to know

* ASSIGNMENT: The top part of the viewer consists of rows of the form:

airplane's heading <- 0

If you drag from the green 'n' purple left-arrow, you'll get an "assignment phrase", which is a line of code that lets you "assign a new value" to live in the heading. Plop it down in a script just like any other command.

Actually, there are four kinds of assignment: simple assignment, incrementing, decrementing, and multiplying; you move among them by hitting the carets on the assignment tile in the Scriptor. A simple exploration will reveal how they work, but be careful with the muliplying assignment -- your numbers can quickly get big.


Advice, Bugs, Things To Avoid, etc.

  1. When you rotate or scale an object, internally there are some tricky things that happen in Morphi, and in consequence, various things in the Halo/Viewer/Scriptor world work fine as long as you're dealing with an unrotated and unscaled object, but will break or bend or cause confusion or contradictions when confronted with a "flexed" (rotated and/or scaled) object. More bugs of this sort showed up at the last minute than we were able to address before the release. Until these bugs are fixed, you may be best advised to operate primarily with "non-flexed" morphs, especially if you run into problems (though this could diminish your fun greatly.)
  2. You will by now have noticed that when you drop a line of script on the Morphic "desktop", it sprouts a "scriptor" around itself, ready for editing and running. This is often what you want, but when it gets annoying, which is to say, when you find you'd like to be able to drop naked lines of script and have them stay as naked lines of script, for later use, you can drop them into any "Playfield" (PasteUpMorph) rather than onto the World desktop, and you can avoid this sprouting.
  3. A nice standard kind of script for lots of experimentation is:
    star forward by 10 "move forward ten units"
    star bounce silence "if hit wall of container, bounce silently"
  4. Scripts that are "ticking" provide a "live" feel, making experimentation quite easy.
  5. Be sure to use the "pen" to lay down color trails. The "colorUnder" and "colorSees" tiles provide ways that objects can easily interact with their surroundings.
  6. The "conditional" in the language is a "Test/Yes/No" complex (your basic if/then/else); in the test pane go boolean-valued things; into the Yes and No panes go any sequence of commands.

    BUG: Nesting of "tests" will never produce the correct results. Don't do it.
  7. When an object is scripted to handle the mouse, you won't be able to drag it with the mouse. To drag such an object, bring up its halo, and drag it from its black-dot handle.
  8. At present, there is no protection against script cycles, so that you can get yourself in trouble with two scripts or more scripts that end up calling each other.
  9. Before trying to duplicate a scripted object, make sure that all its scripts are "saved and named", so that the duplicate you make will have the same scripts.
  10. For the moment, do not count on being able to reload any scripted objects from saved disk files and find them properly working. Of course you *will* be able to, but the mechanism is still under development.

Next Steps

This User-Scripting regime is still in its infancy, as is the documentation about how to use it. We put it out at this time only in hope that some users will find something of interest in spite of the rough state of the design and the code (and in spite of the numerous temporary perturbations it has caused to an otherwise elegant Morphic graphics system.)

Coming in the foreseeable future are extensions of the user-scripting design to cover "aliases", "collections", the "stack/card" dichotomy, file-based factoring of content, Finder-like analogies for content, integration with projects, navigation morphs, integration with the more generic Morphc inspector and browser tools, and more.

Much of this design space has been explored in various earlier prototypes we've worked on, so we're not starting from ground zero, but there's plenty of architectural work still to be done before we emerge with a clean and minimal design that will extend user scripting to span the space of the "multimedia, hypermedia, and simulation tool" that we believe it may become.

Many changes are on the way. We warmly welcome participation by the Squeak community as we pursue this work, which is quite at right angles to the traditional course of Smalltalk. Just, *please*, don't at this stage count on user-scripting to be compact, reliable, consistent, transportable, or stable. If you can thrive on such slippery ice, please join us now! Otherwise, give it a chance to mature over the coming months.

-- The Squeak Team 5/15/98