ScriptX 1.0
Technical Questions and Answers

December 18, 1994

Contents

General Questions

Q: What is ScriptX?

A: ScriptX is part of a complete platform for interactive multimedia. The platform has three major components: the Kaleida Media Player, the ScriptX Language Kit, and application development and authoring tools.

The Kaleida Media Player is the heart of the system. Developers can now create a single application for the Kaleida Media Player instead of targetting specific operating systems like Mac OS and Windows.

The ScriptX Programming Language is a dynamic, object-oriented programming language tailored to the needs of multimedia developers. It is used to create applications for the Kaleida Media Player.

ScriptX is designed from the ground up to work across multiple hardware platforms and operating systems. Version 1.0 is available for Microsoft's Windows 3.1 and Apple's System 7. Future releases of ScriptX will support OS/2, native PowerMac, and other platforms.

The Kaleida Media Player is used to play back ScriptX titles. The appropriate KMP for Windows or System 7 must be installed on a user's computer to run a ScriptX title.

(Up to Table of Contents)

Q: What is in the ScriptX Language Kit?

A: The ScriptX language kit includes an enhanced version of the Kaleida Media Player with extensions for programming tools, numerous code samples, and approximately 2500 pages of documentation. The documentation is provided both as printed manuals and an online version in Adobe Acrobat format.

The ScriptX language kit also includes several low-level programming tools, including a byte code debugger, class browser, and object browser.

Several hundred code sample files illustrate ScriptX programming, and include three complete demo titles (Monterey Canyon, Auto Finder, and Playfarm).

All software is packaged on a CD-ROM and includes both Macintosh and Windows versions of software, sample code, and documentation.

(Up to Table of Contents)

The ScriptX Language

Q: How does ScriptX compare to other OO languages (C++, Smalltalk)?

A: ScriptX is a dynamic, fully object oriented language. It is influenced by Smalltalk, Common Lisp Object System (CLOS), and Dylan, as well as scripting languages such as HyperTalk. Unlike traditional compiled languages such as C++, ScriptX is designed to be easy to use in an interactive fashion, allowing the developer to incrementally build and experiment.

(Up to Table of Contents)

Q: How do I write ScriptX programs?

A: Programming in ScriptX is similar to programming in other object oriented languages.

Programming in ScriptX is very interactive. A Smalltalk-like listener window allows a programmer to directly enter and execute ScriptX statements to incrementally build a title, even while the title is running.

(Up to Table of Contents)

Q: What is the ScriptX object model?

A: ScriptX is a pure object system. Every unit of information is an object, and every expression returns an object.

Classes are themselves objects. Class objects can be queried, assigned to variables, and acted upon in the same ways as other objects. Classes variables and methods define the behaviors and state of class objects.

Methods are invoked through the use of generic functions. Generic functions are called identically to regular functions, with the restriction that a generic always has the target object as its first positional argument.

All methods in ScriptX are virtual and can be modified or overridden by subclasses (polymorphism).

ScriptX supports multiple inheritance. A class may have two or more direct superclasses, combining their methods and instance variables.

Memory management of objects is integrated into ScriptX through an incremental garbage collector. No specific memory deallocation is required for objects that are no longer used.

The garbage collector uses a sophisticated reference tracing algorithm, which avoids dangling or circular references that can result from reference counting schemes. Programmers are able to set the time slice allocated to the collector, or to force a complete garbage collection.

Instance variables are accessed through generic functions known as getters and setters, a design feature modeled on the object-oriented language Dylan. This permits customization of an object's behavior when instance variables are referenced or assigned.

ScriptX supports logical closures. Closures permit the implementation of functions that behave like objects with local state information. Closures are generated automatically by ScriptX and don't require any special programming.

Object level specialization permits a programmer to modify or enhance the behavior of an individual object without requiring the creation of an explicit subclass. Instance variables can be added to individual objects at creation time.

At runtime, methods for classes or objects (including classes in the core class library) may be replaced. This is related to, but distinct from polymorphism, which requires implicit or explicit subclassing.

(Up to Table of Contents)

Q: How easy is the language to learn and use?

A: The ScriptX syntax is relatively simple. Unlike C++, ScriptX makes very little use of special symbols (e.g. ScriptX uses "and" instead of "&&"). Other language constructs such as loops, function definitions, and class declarations are very similar to those found in other object oriented or procedural languages.

For programmers experienced with languages like C or Pascal, the basic ScriptX language syntax can be learned in a short time, typically a few days to a few weeks. The interactive nature of ScriptX makes experimentation easy.

The more difficult task of learning any object oriented programming language is mastering the core class library, and ScriptX is no exception. Programmers with experience in one or more OO languages can build upon their prior experiences; newcomers to OOP will need to allot time for study and experimentation. While there are no hard and fast rules, the conventional wisdom is that new OO programmers face a 3-6 month learning curve to become competent, and upwards of a year or more to achieve mastery.

Numerous books have been published on object oriented analysis, design, and programming. Many of these are applicable to ScriptX and should be considered an important part of the learning process.

Finally, Kaleida Labs offers hands-on ScriptX programming classes, which can greatly increase learning speed.

(Up to Table of Contents)

Q: Are classes treated as objects in ScriptX?

A: Yes, ScriptX is based on a metaclass design similar to that employed in Smalltalk. Classes themselves are objects and can have their own instance variables and methods. Most programmer will never need to be concerned with details of the metaclass system, although some advanced documentation of the metaclass design is included in the ScriptX Architecture and Components Guide.

(Up to Table of Contents)

Q: Is ScriptX compiled or interpreted?

A: It is a hybrid. The core class library (discussed later), contains approximately 250 classes that provide a framework for developing multimedia titles. These classes are compiled into the Kaleida Media Player and the ScriptX language kit system for each platform (Windows, System 7). The ScriptX code that a programmer writes on top of the core classes are compiled into a platform-independent bytecode format that is then interpreted at runtime by the Kaleida Media Player.

In general, the majority of a title's time will be spent in core class methods, thus reducing the performance overhead of the bytecode interpreter.

(Up to Table of Contents)

Q: What are ScriptX's basic data types?

A: Procedural languages like C or Pascal define a set of basic data types (integers, floating point numbers, characters, etc.) from which more complex data structures are built. In a pure object oriented language, there isn't the same clear distinction between basic types and more complex structures. Since everything is an object, in a sense there is only one basic data type: objects!

ScriptX does provide classes that define objects that correspond to the basic data types commonly found in other procedural and object oriented languages. These types include Boolean, ImmediateInteger, LargeInteger, Fixed, ImmediateFloat, and Float.

Note that ScriptX does not provide a class to represent individual characters; sequences of ImmediateInteger objects are used to represent text strings. ScriptX automatically converts between numeric formats when necessary.

(Up to Table of Contents)

Q: What are ImmediateIntegers and ImmediateFloats?

A: An immediate object is a ScriptX object that "collapses" into the final 30 bits of its own pointer. These classes can save on memory allocation; ImmediateFloat objects take just four bytes of memory, Float objects require 36 bytes.

There is a tradeoff in precision or range when using ImmediateInteger and ImmediateFloat objects. An ImmediateFloat object also imposes a performance penalty, since all floating point values must be converted into a machine-specific format for calculation. (ImmediateIntegers likewise incur a small additional overhead for calculations.)

For most purposes, developers can ignore the existence of immediate objects. Even though they are not full-fledged objects, immediate objects define all the operations that can be performed on regular objects.

(Up to Table of Contents)

Q: Does ScriptX support multiple threads?

A: Yes, ScriptX has built in support for multiple threads of execution. This feature, found in more advanced operating systems, allows the programmer to create applications that can more naturally model real world behaviors. Multiple objects can be "live" and interact among themselves.

Threads can be created and destroyed at will. Threads are assigned either normal or high priority, and are preempted periodically. Threads run independently; except for the scheduler, they manage themselves.

Threads can be created easily by appending any ScriptX expression with an ampersand (&) character.

(Up to Table of Contents)

Q: Can I deliver a title with no source code present?

A: Yes, titles typically will only contain ScriptX bytecode. This provides the software developer with protection against others examining or stealing the source code to a title. Bytecode is also significantly more efficient than interpreting source code.

(Up to Table of Contents)

Q: What is ScriptX bytecode?

A: ScriptX source code is compiled into a platform-independent format known as bytecode. This bytecode is then executed by the Kaleida Media Player.

Bytecode is similar to machine-level instructions found in Intel or Motorola processors. For example, the following ScriptX statement:
    b := 2 * a
translates into the bytecode instructions:
    0: PUSH-8BITS 2
    2: PUSH-EXTERNAL-VARIABLES Scratch:a
    4: MULTIPLY
    5: STORE-INTO-EXTERNAL-VARIABLE Scratch:b
Programmers normally need not be concerned with bytecode, although the debugger shows bytecode instructions mnemonically.

(Up to Table of Contents)

Q: How does ScriptX support large programs and reusable objects?

A: Through the use of modules. Modules permit the programmer to partition the name space into multiple disjoint subsets and control access among modules. This permits the creation of separate libraries of ScriptX objects that can hide implementation level components and avoid name collisions as they are combined. ScriptX modules are similar to the packaging system in Lisp or the proposed namespace mechanism in C++.

ScriptX itself defines one standard module named "ScriptX" which contains and exports all the variable names in the ScriptX core classes, including names of classes, generic functions, and global variables.

Modules also simplify the process of saving classes, objects, and functions into files. By simply storing a module into a file, all associated members of the module will be stored automatically. Without modules, you must individually store each class and object and you must reconstruct any global variables that the program requires.

(Up to Table of Contents)

Q: What access control features does ScriptX offer?

A: In ScriptX, a class' instance variables and methods are publicly accessible within the module where the class is defined. Instance variables and methods can be exported for use by methods in other modules.

By explicitly overriding a class or object setter or getter method, a programmer can make an instance variable read only or provide custom data validation.

ScriptX does not support the C++ concepts of protected instance variables or methods, or private/protected inheritance.

(Up to Table of Contents)

Q: How does ScriptX handle error conditions?

A: Through exception handlers. The exception system in ScriptX is similar to the exception mechanism in C++ (although not all C++ compilers currently implement exceptions).

The ScriptX exception system is made up of three parts: (Up to Table of Contents)

Q: Can I call C code from within ScriptX?

A: Yes. You can use the Watcom C compiler (Windows) or the THINK C compiler (Macintosh) to write external code. Code modules are loaded in dynamically at runtime by the Kaleida Media Player.

The situations where you would want to write external code fall into two categories: for computational performance reasons, or to access devices or software not directly accessible from within ScriptX.

In version 1.0, the C interface is limited to passing basic data types across from ScriptX: character, strings, integer, floats, and boolean.

(Up to Table of Contents)

Q: What compilers are ScriptX compatible with?

A: Symantec's THINK C compiler (version 6.x and 7.x) can be used under System 7. For Windows, you must use the Watcom version 9.5 C compiler.

(Up to Table of Contents)

Q: Can I use Microsoft's Visual Basic or Visual C++ compilers with ScriptX?

A: No. The linkage model for external code is not compatible with Visual Basic or Visual C++.

(Up to Table of Contents)

Q: Can I use C++ with ScriptX?

A: No, the object models of ScriptX and C++ are incompatible. On a very limited basis, the external C interface described in the previous question can serve as a gateway between ScriptX code and C++ code by using static member functions declared with C linkage. However, C++ objects and ScriptX objects cannot be passed across the interface which limits the usefulness of mixing ScriptX and C++.

(Up to Table of Contents)

The ScriptX Core Class Library

Q: What is the ScriptX core class library?

A: The core class library consists of approximately 250 classes that provide a framework for ScriptX titles. By using the core class library, a programmer can very quickly build an application, complete with animation effects, video, and audio.

The core class library provides both low level services and high level services to the programmer. A typical low level service would be collection classes (arrays, hash tables, etc.). A group of classes that implement a card-stack interface for a title is a typical high level service.

The core classes are compiled into the Kaleida Media Player, resulting in higher performance.

(Up to Table of Contents)

Q: How does the ScriptX core class library compare to class libraries available with other programming languages (e.g. MFC, OWL, MacApp, or TCL)?

A: The ScriptX core class library has many similarities to other object oriented frameworks in that it provides many basic services common to all applications built on them. All frameworks provide classes for creating windows, handling keyboard and mouse events, reading and writing files, etc.

Where ScriptX is unique is in its focus. The ScriptX core classes are oriented towards interactive, media rich applications. For example, clocks and timing are fundamental in the ScriptX class library; most other frameworks have no concept of timing built in.

ScriptX also tightly integrates media data (bitmaps, video, audio) with the class library, and hides the details of storing, retrieving, and presenting media to the user.

(Up to Table of Contents)

Q: What are the major sections of the core class library?

A: The following highlight some of the major components in the class library, but this is not an exhaustive list of the classes in the core class library. For more information, refer to the ScriptX Core Classes Reference. (Up to Table of Contents)

Q: Is the core class library rooted?

A: Yes. All classes derive from a root class, RootObject. The RootObject class provides behaviors common to all objects. For example, RootObject implements methods for storing/retrieving to disk and run time type information (RTTI).

(Up to Table of Contents)

Q: Is source code for the core class library included?

A: No, Kaleida will not make the source code for the class library available. Nearly all of the core class library is written in OIC (see section below) and compiled into the Kaleida Media Player and ScriptX.

This also precludes stepping through core classes using the bytecode debugger, since these classes are not made up of bytecode.

(Up to Table of Contents)

Multimedia Support

Q: What support for different types of media (bitmaps, video, audio) does ScriptX offer?

A: The actual media used by various classes in ScriptX are tightly integrated into the language. Media is imported into ScriptX where it can be stored in the same files as the objects. Programmers do not have to deal with the raw formats for graphics and sound, but manipulate these as object method calls to play back or display media.

(Up to Table of Contents)

Q: What media types does ScriptX support?

A: ScriptX can import plain ASCII, rich text format (RTF), PICT, PICT2, DIB, AIFF, SND, WAVE, AVI, Quicktime, and MIDI.

(Up to Table of Contents)

Q: How is digital video handled in ScriptX?

A: There are two methods.

First, Quicktime and AVI format movies can be imported into ScriptX; the resulting MoviePlayer objects are stored in ScriptX's object format and can be easily retrieved and played back. Quicktime and AVI movies imported in this fashion must be compressed using Cinepak.

The second option is to leave movies outside of ScriptX, and invoke the appropriate Quicktime or VFW calls to play them back inside a window.

The advantage of the first method is that the resulting movie objects will run across different platforms without problem. Also, movies handled in this fashion can be synchronized with other time based actions (sound, animation) and other ScriptX objects can coexist in the area of the screen where the movie is playing: text can be composited over the movie or animations can move across it.

The second method provides flexibility in terms of supporting different compression formats and allowing users to play arbitrary movies "on the fly" without having to first import them into ScriptX.

(Up to Table of Contents)

Q: Does ScriptX support hardware video compression?

A: Yes, through external codecs that may be available on a particular platform for Quicktime or Video For Windows. In this case, the programmer must use the external video interface described in the previous question.

(Up to Table of Contents)

Q: Does ScriptX support bitmap compression?

A: Yes. In version ScriptX version 1.0, you can import bitmaps stored in Quicktime format compressed with Cinepak. The image must be a keyframe in the Quicktime movie.

ScriptX also can import and store DIB images compressed with run length encoding compression (RLE4 or RLE8).

(Up to Table of Contents)

Q: Can video be synchronized with other events?

A: Yes, internal video players are based on ScriptX clocks and can be slaved together to provide synchronization with animations and other events. For example, buttons can appear in a window at precise times based on video playback.

(Up to Table of Contents)

Q: Does ScriptX support interleaved video streams?

A: Yes, but only for Quicktime movies. Support for interleaved movies imported from Video For Windows format will be available in a future release.

(Up to Table of Contents)

Q: Does ScriptX support custom palettes?

A: Yes. Palettes can be imported with graphics directly, or the programmer can specify a custom palette for a window at runtime.

(Up to Table of Contents)

Q: Does ScriptX support bit depth scaling?

A: ScriptX will automatically adjust for differences in bit depth between the current monitor settings and bit depth of bitmaps and video.

ScriptX uses the dithering mechanism of the host operating system (System 7 or Windows).

(Up to Table of Contents)

Q: How many channels of audio does ScriptX support?

A: On System 7, four channels of stereo audio may be played at once. Under Windows, there is no theoretical limit to the number of audio players, but in practice four is a reasonable number there as well.

ScriptX performs audio compositing (mixing) directly. The AIFF source data for multiple simulataneous audio players may be at different rates (for example, one at 11 kHz and one at 22 kHz).

(Up to Table of Contents)

Q: How is text handled in ScriptX?

A: Both plain ASCII and rich text format (RTF) text can be imported into a ScriptX title. The core class library contains classes to display and edit text fields.

Internally ScriptX uses the Unicode Translation Format (UTF) to encode characters, where each character is stored as a sequence of 1 to 6 bytes. This encoding scheme is very efficient for text that consists of all ASCII (0-127) characters.

Text displayed on the screen can be styled. The color, style, leading, alignment, and indentation can be set for a range of characters or the entire text block.

An action can also be assigned to a range of characters, The action contains a function or method which is executed when a point in the text range is selected. This can be used as the foundation for hyperlinks.

(Up to Table of Contents)

Q: How does ScriptX handle fonts?

A: Font scaling and rendering in ScriptX uses the font technology of the underlying platform such as TrueType , and the fonts that have been installed on that system. A core class, PlatformFont, provides an object interface to the underlying font technology and available fonts on a specific platform. A Platform object allows you to specify separate Macintosh and Windows font names that may have similar appearance (for example, Geneva on System 7 and Arial on Windows).

(Up to Table of Contents)

Q: Does ScriptX support anti-aliased text?

A: No, not in version 1.0.

(Up to Table of Contents)

Q: Can I export media or text from a ScriptX title?

A: Unfortunately, not in version 1.0. The ability to export media will be added in a future release. In version 1.0, raw text can be written out to a file, but any formatting associated with it will be lost.

(Up to Table of Contents)

Q: Can I print from within ScriptX?

A: No. This will be added in a future release.

(Up to Table of Contents)

Q: Does ScriptX support 3D objects or sharing objects across a network?

A: Not in version 1.0, but these features are scheduled for future versions of ScriptX.

(Up to Table of Contents)

Programming Tools in ScriptX

Q: What programming tools are included with ScriptX?

A: ScriptX 1.0 includes a thread-oriented bytecode debugger, a source browser, a module browser, a class browser, and an object browser. These tools are written in ScriptX itself, demonstrating the power of the language for developing tools.

(Up to Table of Contents)

Q: What are the main features of the bytecode debugger?

A: The debugger can be used to step through your code's methods and functions, set conditional and unconditional breakpoints, and trap exceptions. The debugger shows the sequence of function or method calls that lead up to the exception (the call stack); you can then examine the arguments and the code for each function or method. You can also set watchpoints to monitor the value of a variable or expression.

(Up to Table of Contents)

Q: Is a source code debugger available?

A: No. This is planned for a future version of ScriptX.

However, the bytecode debugger is "source code aware" and can toggle between showing the bytecode and the source code to your methods or functions.

(Up to Table of Contents)

Q: What is the Director Toolkit?

A: The Director Toolkit, or DTK, is an extension to ScriptX that allows you to import files created in Director into ScriptX. It can be used with files created with Macromedia Director 3.1.3 or 4.0. The DTK is only available on the Macintosh version of ScriptX.

The Director to ScorePlayer importer provides basic import features for converting a castlist and score. It converts frame-based animations created in Macromedia Director to a hierarchy of objects in ScriptX.

The DTK can be customized to create custom importers that convert individual components of a Director file into ScriptX objects.

The DTK cannot import everything in a Director file. The current version of the importer cannot import scores that use shared castmembers, Lingo scripts, film loops, color ink effects, palette transitions and cycling, some types of scene transitions, XObjects, XCMDs and XFCNs, buttons or 32-bit bitmap graphics.

(Up to Table of Contents)

Q: What AppleEvents, OLE support does ScriptX have?

A: ScriptX 1.0 supports the core AppleEvent suite under System 7.

ScriptX does not support DDE or OLE under Windows. You can launch titles by specifying the title name as a command line parameter to the Kaleida Media Player.

(Up to Table of Contents)

Objects In C

Q: What is Objects In C?

A: Objects in C (OIC) is a suite of function, macro, and class libraries that provide the object model used by ScriptX. OIC is modeled on CLOS, the ANSI standard LISP object-oriented programming system and supports capabilites such as dynamic types, global polymorphism, and dynamic method redirection.

OIC only requires an ANSI C compiler, which makes it highly portable.

Both ScriptX and the Kaleida Media Player are written in OIC.

(Up to Table of Contents)

Q: Can I program with OIC?

A: Not at this time. Kaleida has not announced any plans for releasing OIC documentation and programming tools. The external C interface that is provided with ScriptX provides a mechanism for programmers who need to add functionality that cannot be written directly in ScriptX.

(Up to Table of Contents)

Documentation

Q: What documentation is included with the ScriptX Language Kit?

A: The ScriptX documentation contains over 2,500 pages of information in five volumes: (Up to Table of Contents)

Q: Is the documentation available in electronic form?

A: Yes. The ScriptX Language Kit contains two forms of electronic documentation.

The ScriptX class browser displays method definitions for the core class methods, making it easy to look up the calling parameters for a particular method.

In addition, the three main manuals (the Core Class Reference, Field Guide, and Architecture and Components Guide) are provided in the Adobe Acrobat portable document format (pdf). The Acrobat 2.0 Reader software for Macintosh and Windows is included on the CD-ROM.

(Up to Table of Contents)

Q: What tutorial and source code examples are included in the ScriptX Language Kit?

A: The language kit includes numerous source code examples to learn how ScriptX programs are written. These range from simple (10-100 line) examples illustrating particular features all the way through complete demo titles such as Monterey Canyon, Auto Finder, and Playfarm. These demo titles include the complete source code, detailed documentation on how the demos work, and all necessary artwork, video, and sound clips.

The ScriptX Quick Start Guide contains a tutorial that give new ScriptX programmers an introduction to the language, class library, and tools.

(Up to Table of Contents)

ScriptX and KMP System Requirements

Q: What hardware is required for ScriptX and the KMP?

A: The requirements for ScriptX (the development environment) and the Kaleida Media Player are slightly different.

The Kaleida Media Player minimum requirements are:

Windows
General
486/DX 25 MHz or faster, or Pentium Processor
Memory
At least 8 MB RAM
Audio
At least 8-bit PCM: 11, 22, 44KHz sample rates
Video
At least 640 x 480 screen resolution in 8, 16 or 24 bit color
Disk space
2.5 MB for KMP
System 7
General
68040 25 MHz or faster, or PowerPC 601
Memory
At least 8 MB RAM
Audio
(Built in)
Video
At least 640 x 480 screen resolution in 8, 16 or 24 bit color
Disk space
1.7 MB for KMP
Depending on a specific ScriptX title's requirements, these may vary. For example, titles that use 24 bit images on large screens will likely need more than 8 MB RAM.

Without any title loaded, the Kaleida Media Player requires the following amounts of RAM: The ScriptX Language and Class Library's minimum requirements are:

Windows
General
486/DX 25 MHz or faster, or Pentium Processor
Memory
At least 8 MB RAM
At least 12 MB RAM if tools are installed
Audio
At least 8-bit PCM: 11, 22, 44KHz sample rates
Video
At least 640 x 480 screen resolution in 8, 16 or 24 bit color
Disk space
7 MB for ScriptX and tools. Additional space is required for code samples and online documentation.
System 7
General
68040 25 MHz or faster, or PowerPC 601
Memory
At least 8 MB RAM
At least 12 MB RAM if tools are installed
Audio
(Built in)
Video
At least 640 x 480 screen resolution in 8, 16 or 24 bit color
Disk space
7 MB for ScriptX and tools. Additional space is required for code samples and online documentation.
As with any development system, more memory and faster CPU's are always a good idea.

A complete installation with all code samples and online documentation requires approximately 160 MB of disk space.

(Up to Table of Contents)

Q: What software is required to run ScriptX and the KMP?

A: The Windows versions require either Windows 3.1 or Windows For Workgroups 3.11 running on top of DOS 5.0. To use the external video support requires either Video For Windows or Quicktime for Windows (1.0).

The Macintosh versions require MacOS 7.1 or 7.5. The Sound Manager extension (2.0 or later) is required, and the Quicktime extension (1.6.1 or later) is required to use the external video support.

(Up to Table of Contents)

Q: What Windows video cards and device drivers does ScriptX work with?

A: Refer to Chapter 1 of the ScriptX Quick Start Guide for the initial list of supported video hardware. Additions to the list will be available electronically on Kaleida's World Wide Web page and ftp server.

(Up to Table of Contents)
Copyright 1994, Kaleida Labs, Inc.