Lingo (programming language)

From Wikipedia, the free encyclopedia

Lingo is a scripting language developed by John H. Thompson for use in Adobe Director (formerly Macromedia Director), used for regular desktop applications, interactive kiosks, CD-ROMs and Adobe Shockwave internet sites. HyperTalk is likely to have been one of the inspirations for Lingo.[citation needed]

Syntax

When Lingo was created, a verbose syntax was designed to mimic spoken language, so it would be easy for beginners to get started. You could write whole HyperTalk-like sentences such as:

if sprite 5 is visible then go to the frame

Note that in "go to" statements the "to" is optional. Also note that unlike other programming languages, "go" statements reference frames in Director's Score, not particular lines of code.

Lingo was also initially very robust by providing object generation through a notion called factory, which led to the language's extensibility through External Factories (XFactories) or XObjects.

Although it is still possible to use the verbose syntax, the current version of the language fully supports dot syntax, so that the code looks more like standard programming languages such as JavaScript or C++.

The equivalent in new scripting style would be:

if sprite(5).visible then _movie.go(_movie.frame)

This format uses elements of the Director Object Model, introduced in Director MX 2004. The syntax in prior versions would be like:

if sprite(5).visible then go the frame

Usage

Lingo is embedded into Adobe Director. Lingo is an object-oriented programming (OOP) language.

There are 4 types of scripts in Lingo:

  • Cast script a script works only with its member not all the events can be used with it
  • behavior scripts are attached to a sprite or inserted into a frame. Sprite behaviors are often used to give control of the sprite's properties and movement. Frame behaviors can be used to create a pause or delay within a certain frame in the score. Behaviors make it easy to program in an object-oriented way, as you can directly see the relationship between the programming and the item they are attached to. They can also control or interact with other sprites, making them a true object.
  • movie scripts are not attached to sprites nor can they be instantiated as Objects. They are available throughout the program (movie) and are especially useful for holding global handlers and initializing global variables at the start or end of the movie.
  • parent scripts are used to "birth" (create instances of) an Object into a Variable using the "new" command. These objects can control sprites and other media remotely, without being attached to any one sprite, may be used to control data or other non-displayed items, and are useful for recursion routines such as pathfinding. A Parent script can be used to create or destroy an object at anytime, freeing them from the confines of the score that a Behavior is limited to.

Behavior and parent scripts encourage good object-oriented programming. Movie scripts are not as OOP-oriented; however, they can still be used to make "black-box" handlers, where other objects can input raw data and receive answers back, without knowing the inner workings of the box. Using the strengths and ease-of-use of Director's programming methodology, with the advantages of OOP makes for a powerful and fast programming environment.

Lingo supports object inheritance by a slightly idiosyncratic system: a script can have an ancestor property which references another object (usually also a script, although other objects such as cast members can also be ancestors). Properties and methods of the ancestor are inherited by the parent. Behavior scripts are also a kind of ancestor of the sprites to which they are attached, since properties and methods of the behavior can be accessed by reference to the sprite itself. In this case, we have a kind of multiple inheritance, as one sprite may have several behaviors.

XObjects

Lingo was also extensibile through External Factories (XFactories) or XObjects (later called Lingo Xtras), which provided programmatic extensions to Director. For example, controlling external media devices such as CD-ROM and Video tape players through Macintosh SerialPort. XObject API was openly available to developers and media device producers, which added to the popularity and versatility of Lingo. Macromind was very active in positioning the XObject API as standard for external media devices to collaborate through Lingo; and its interest as a standard achieved a lot of involvement from prominent and burgeoning media product companies through an ad hoc group called the Multimedia Association.

Imaging

A very powerful part of the language is Imaging Lingo. It was introduced when Director version 8.0 arrived. It gives the user the power of image manipulation with simple commands. There are some similarities to functions of image applications (like Photoshop), that make it easy to create dynamic, code-based visual effects. Since then imaging has also been added to Adobe Flash's ActionScript language with the Flash BitmapData object. As this included more sophisticated commands, Director was also updated to allow conversion between the BitmapData object and its own Image objects.

3D features

In Director 8.5, a full 3D engine was included for the first time. Lingo was updated substantially to support the new 3D objects and now includes a well-featured (if by now slightly out of date) set of 3D commands. An Xtra was also created to enable use of the Havok 3D Physics engine. Director 11 introduced a new physics Xtra using the Ageia physics engine.

Other languages called Lingo

  • A language called Lingo was released for software development under Windows. This version was designed as a compilable high level programming language.
  • A programming language based on Smalltalk was developed for the Rekursiv processor developed by Linn Smart Computing in Scotland, UK. This language was called Lingo and is significant because the manufacturers successfully obtained a trade mark in the UK.
  • LINGO is also a programming language for solving linear, nonlinear and integer optimization problems, first developed in 1988 by LINDO Systems Inc. This language is still in production.

These other languages are perhaps not as well known as the Macromedia language. However, a legal anomaly remains in that the legal trademark of the word 'Lingo' in the UK is not held by Macromedia, but by Linn.

Early Adopters

Lingo was quickly adopted by burgeoning multimedia community and the already popular Micromind Director product. Initially, about 90% of the users only used 10% of Lingo's features; primarily go to the frame by multimedia authors of tutorials and presentations. However, 10% of the users were game developers who took a wider interest in the other 90% of the functionality, including their own functional extensions by creating their own XFactories/XObjects. The Journeyman Project is a prominent example of this.

Additional Contributors

Jeff Tanner (programmer), a former Macromind employee who worked for John Thompson in developing and testing initial Lingo for Macromedia Director 2.2 and 3.0, created custom XObjects for various media device producers, language extension examples using XFactory including the XFactory API, and wrote the initial tutorials on how to use Lingo. Worked with Marc Canter, founder of Macromedia in writing white papers to promote XObject API to Multimedia Association, an ad hoc group of media device providers working together to provide extensibility to Lingo.

References

    External links

    This article is issued from Wikipedia. The text is available under the Creative Commons Attribution/Share Alike; additional terms may apply for the media files.