Lingo

Lingo is the Computer programming language which accompanies the software Macromedia Director.

Origin of the name

The word Lingo means in English Argot, within the meaning of vernacular language , specialized language pertaining to a precise group (e.g. slang of the typographers).

Characteristics of the language

The syntax of Lingo is very simple and very readable, she points out (by far) the BASIC or the Pascal. Lingo is a derivative or dialect of the language HyperTalk used in the software author HyperCard distributed on the Macintosh as from 1986. It was envisaged at the beginning to be most readable possible for the english-speaking.

  • set mavariable to 10

  • go to frame 20
  • set Word 4 off montexte to " bonjour"

Syntax

Voici an example of function:

one multiplies (has, b) 
    return a*b
end multiplies

The functions indeed begin all with one of fonction' and end in end function . Lingo is a language very laxist, one for example is authorized not to put the brackets after the name of the function (one multiplies has, b).

To note, the variables are typified dynamically and there does not exist differentiation between the " =" of assignment and the " =" of comparison.

yew a=1 then
   b=2
else
   yew a=" a chaîne" then
      b=3
   end yew
end yew

After years of syntactic evolution, Lingo became a language " pointé" enough traditional, and thus very readable.

Director is a software dedicated to the interactivity. Consequently, Lingo allows the easy interception of a great number of events such as: preparemovie (before posting), startmovie (at the time of posting), mousedown (inserted click), mouseup (slackened click), etc Certains scripts interceptors events relate to the whole of the program, others can apply only to precise objects, like the sprites (occurrence of an object - for example graphic - on the scene ).

one mouseup 
        -- when one clicks on the object to which this script  applies 
   yew the mouseh<320 then
        -- if the horizontal position of the mouse is lower than 320
      puppetsound (1, " bing")
        -- one starts the sound named " bing" on track 1.
   end yew
end

Some elements of syntax

  • the names of the variables can contain letters, figures, or underscore signs it. They cannot start with a figure.
  • one can create symbols with the sign sharp ( # ). A symbol is not a variable.
for example, in maCoulor = #rouge , the word #rouge does not mean anything for Lingo; on the other hand, it allows a readable code for the programmer.
  • the assignment is done with the sign =
  • the comparison is done as follows:
    • = (equality)
    • < (lower)
    • > (higher)
    • <= (lower or equal)
    • >= (higher or equal)
the operators is the same ones as it is necessary to compare entireties, chains, or anything of other.
  • the tables (lists) create for themselves thus
monTableau = '' or monTableau = ''
  • the tables can contain tables
monTableau = 1,2], [1,5
  • the tables can be associative
monTableau = #sexe: " masculin" , #taille: 1.80
  • the comment S are preceded by two indents: --

Points, rectangles, quads

Lingo makes it possible to handle variables of coordinates such as the points, the rects and the quads.
  • a point is noted as follows: not (10,10)
  • a rectangle is noted as follows: rect (10,10,30,40) -- rectangle from 20pix broad and 30 top starting as in point 10,10
  • a quad is a list of 4 points. By handling the quads one can deform rectangles.
ex : Not (10,10), not (10,30), not (30,40), not (10,40) .

the interest of this kind of variables is that Lingo proposes preset functions making it possible for example to know if a given point is included in a given rectangle. In addition, one can apply arithmetic operations to these variables. Example: not (10,10) +point (5,5) will give: not (15,15)

Lingo also has a whole series of functions which make it possible to handle the vectors 3D easily: scalar additions, products, distances, matrices of transformation…

Types of scripts

There exist 4 types of scripts in Lingo and it is a potential source of errors, which predetermine the use which could be made of the aforesaid scripts:

Traditional scripts

  • scripts known as d'" animation" , which is attached to whole animation and which is the equivalent of a procedural code. One puts only total variables and functions at it. Total scripts receive some preset function-events.
  • scripts known as " parents" who allow to simulate classes of object.

an example of script relative:
property pNombre 
-- declaration of an internal variable to the object
 

one new me, N pNombre = N return me end

me am incremented pNombre = pNombre +1 end

If this script names " nombre" , one will instanciera it for example in this manner:
monNouveauNombre = new (script " nombre" , 10)
and his function " will be called upon; incremente" in this manner:
monNouveauNombre.incremente ()

Scripts applicatifs

These are complex objects from which script is not directly accessible and which one develops for the graphic designers and integrators.

  • scripts known as " comportement": By simple a drag and drop these scripts are attached to objects of the scene: image, sprite, actor. These scripts have preset functions which make it possible to parameterize the authorities manually.

  • scripts known as of actor, which are hidden in the actors of the library.

Implementations

Lingo is a language owner, it thus exists only one implementation about it.

Future

In its version MX2004 , the Director software accepts the use of two different languages: the Lingo , and an implementation of Javascript/ECMAScript adapted.

Random links:Aplodinotus grunniens | Legislative and presidential election Nicaraguan of 2006 | Inter-commune hospital Raincy-Montfermeil | Beautourne | Marais_NNR_de_Bure