Lingo Programming in Directors Language - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Lingo Programming in Directors Language

Description:

Lingo Programming in Director's Language. TECH2001 EPP2. Jon Ivins. Reading for this lecture ... For example, picture is a property of a bitmap cast member. ... – PowerPoint PPT presentation

Number of Views:150
Avg rating:3.0/5.0
Slides: 18
Provided by: cseD1
Category:

less

Transcript and Presenter's Notes

Title: Lingo Programming in Directors Language


1
Lingo Programming in Directors Language
  • TECH2001 EPP2
  • Jon Ivins

2
Reading for this lecture
  • This is a stand-alone topic
  • Read Chapter 1 of Peuple et al

3
Overview
  • What is Lingo?
  • Lingo Terms
  • Verbose syntax
  • Dot syntax
  • THIS LECTURE IS AN INTRODUCTION TO LINGO NOT A
    PROGRAMMING COURSE!

4
LINGO
  • Part of Director
  • In-built programming language
  • Own syntax
  • Own semantics
  • Code is attached to objects on screen, on the
    score or the cast
  • This code can be simple or complicated!

5
LINGO TERMS (taken from Director Help File)
  • Commands are terms that instruct a movie to do
    something while the movie is playing.
  • Constants are elements that dont change.
  • Events are actions that occur while a movie is
    playing.
  • Expressions are any part of a statement that
    produces a value. For example, 2 2 is an
    expression.

6
LINGO TERMS (taken from Director Help File)
  • Functions are terms that return a value. For
    example, the date() function returns the current
    date set in the computer. The key() function
    returns the key that was pressed last.
    Parentheses occur at the end of a function.
  • Handlers are sets of Lingo statements within a
    script that run when a specific event occurs in a
    movie. For example, the following statements
    comprise a handler that plays a beep sound when
    the mouse is clicked
  • on mouseDown
  • beep
  • end

7
LINGO TERMS (taken from Director Help File)
  • Keywords are reserved words that have a special
    meaning. For example, end indicates the end of a
    handler.
  • Lists are ordered sets of values used to track
    and update an array of data, such as a series of
    names or the values assigned to a set of
    variables. A simple example is a list of numbers
    such as 1, 4, 2.
  • Messages are notices that Director sends to
    scripts when specific events occur in a movie.
    For example, when the playback head enters a
    specific frame, the enterFrame event occurs and
    Directors sends an enterFrame message. If a
    script contains an on enterFrame handler, the
    statements within that handler will run, because
    the handler received the enterFrame message.

8
LINGO TERMS (taken from Director Help File)
  • Operators are terms that calculate a new value
    from one or more values. For example, the
    addition () operator adds two or more values
    together to produce a new value.
  • Properties are attributes that define an object.
    For example, picture is a property of a bitmap
    cast member.
  • Statements are valid instructions that Director
    can execute. For example, go to frame 23 is a
    statement.
  • Variables are elements used to store and update
    values. To assign values to variables or change
    the values of many properties, you use the equals
    () operator or the set command. For example, the
    statement set startValue 0 places a value of 0
    into a variable named startVal
  • Variables can be local or global

9
Scripts
  • These are pieces of program code written in Lingo
  • They are self-contained
  • They can act on individual objects, groups of
    objects or over the whole movie
  • Behaviour library is a collection of useful
    scripts

10
Scripts
  • Two types
  • Verbose
  • very much like English, easy to understand
    individual lines
  • Hard to debug complicated scripts as lot of text
    to read
  • x 2 2
  • put string(x) into member "The Answer"
  • Dot syntax
  • Abbreviated format so easier to type
  • Can switch between Verbose Dot as you wish
  • Some commands only exist in Dot Syntax

11
Verbose Syntax Examples
  • set the stageColor to 255
  • put the text of member "Instructions" after
  • member "Introduction"
  • if x5 then
  • go to frame 22
  • end if

12
Dot Syntax example
  • VERBOSE
  • set the forecolor of sprite 12 to 155
  • DOT
  • sprite(12).forecolor 155

13
Testing Scripts ..if then else loops
  • if the mouseMember memberNum("map 1") then
  • go to "Cairo"
  • else if the mouseMember member ("map 2") then
  • go to "Nairobi"
  • else
  • alert "Youre lost."
  • end if

14
Testing Scripts..Cases
  • on keyDown
  • case (the key) of
  • "A" go to frame "Apple"
  • "B", "C"
  • puppetTransition 99
  • go to frame "Oranges"
  • otherwise beep
  • end case
  • end keyDown

15
More Cases
  • This case statement tests whether the cursor is
    over sprite 1, 2, or 3 and runs the corresponding
    Lingo if it is
  • case the rollOver of
  • 1 puppetSound "Horn"
  • 2 puppetSound "Drum"
  • 3 puppetSound "Bongos"
  • end case

16
Tips to start programming
  • Think about the order that the script has to do
    things
  • Write down what you want to do in English then
    convert it to Lingo
  • Make use of the help file most answers are in
    there!!
  • Hierarchy charts, Flowcharts, Pseudo-code,
    decision trees tables are useful tools for code
    design

17
References
  • The Director Help File
  • Macromedias knowledge base accessed from
    www.macromedia.com
  • There are several good books in the library but
    none are recommended in their entirety
Write a Comment
User Comments (0)
About PowerShow.com