Home‎ > ‎

LiveCode - What is it?

LiveCode - What is it?
1. What is LiveCode? Who uses it?
2. How Easy is it? 
3. What  Apps and Programs can you write with it?



1. What is LiveCode?
LiveCode is an easy, English-like, object-oriented, event-driven programming language. Despite it's simplicity, it is a powerful, full featured language with over 2,000 commands and behaviors. It is used by many corporations, government agencies, academic institutions and school systems. 

The community version is free, open source and actively being enhanced and extended. It deploys programs on every platform including Windows, OS/X, Linux, iOS, Android and even HTML as standalone. (Standalone means that it will run on any computer. You do not need to have or install LiveCode to run them). The newest version has a Foreign Function Interface (FFI) allowing it to run native Javascript and Java Classes. More interfaces are coming

    LiveCode - Main sites = LiveCode.org (community/free version) and LiveCode.com  (commercial version)
    Who is using it? - Some of the customers using it.(includes NASA, KLM Airlines, Univ. of Vienna, BYU,  NY Law School, etc)
    Review of It - Review: It's Freaking Incredible
    Turing Festival - Presentation at the Turing Festival where the CEO builds an app in 3 minutes
    KickStarter Project - This is how the Open Source version started
    What_Is_LiveCode?  - An interesting take on LiveCode
    OpenSource - Good intro story to LiveCode - 
    PCWorld Review - another review ... but there are others better and newer (Do a Google Search)

    News:
                OpenSource - Good intro story to LiveCode - PCWorld Review -
                LiveCode for Developers

    Videos:
                Info - Features -  Turing Festival - a Sample Video Game

    Who Uses It?:
                Customers - Applications - Others - Veterans Admin. -  


2. How Easy is it? 
Livecode is basically English commands. Even though it is a powerful, full-featured, object-oriented and event-driven language, it is easy to read, write and debug. It is like writing in psuedo-code. You can concentrate on the program and not the language.

    You program in LiveCode as you do with other languages. The syntax is relaxed and the command set is English-like.

    A few of the commands in LiveCode: (See how English-like they are, it is just like talking. Yes, programming can be that easy)

 ask "What is your name?"
        if yourAnswer is "Yes" then do this else do that
        put 0 into field "score"
        add 10 to field "score"
        subtract 10 from field "score"
        hide image "egg"
        show image "chick"
        play "birdChirping.wav"
        move image "bird" to 100,238 in 2 secs
        wait 3 secs
        repeat 10 times
        repeat from 10 down to 1
        go to card "instructions"
        answer "Do you want to play?" with "Yes" or "No"
        intersect (image "arrow" , image "apple")
        revSpeak ("Good morning, how are you today.")


The following is actual code that will run on PC computers, Apple computers, Linux computers, iOS devices (iPhone, iPad) and Android devices (smartphones, tablets)  or in a web browser. These were all written by high school students (grades 9-12, ages 13-17).

Not knowing the language, look at the actual examples below and see if you can understand what is going on.

    A. Number Guessing Game:

       

on openCard
    put 10 into field "tries left"
end openCard

on GuessMyNumber
     local myNum, guess                                                                      (these are variables where we save the original number and the guesses)
     put random(100) into myNum                                                        (this has the computer pick a random number between 1 and 100)
     answer "I am thinking of a number from 1 to 100, would you like to try to guess it in 10                               tries?" with "No" or "Yes"
     if it is "Yes" then
          repeat for 10 times
                 ask "Try again, what is your guess?"
                 put it into guess
                 if guess < myNum then answer "Your answer is too low, guess higher"
                 if guess > myNum then answer "Your answer is too high, guess lower"
                 if guess = myNum then
                        answer "Good job, you guessed it"
                        exit GuessMyNumber
                end if
                subtract 1 from field "tries left"
         end repeat
    end if
    answer "10 guesses are up. The answer was " & theNumber
    put 10 into field "tries left"
end openCard


   B. Children's Matching Game ("drag and drop")

In this first screen, you have to match the animals on the right to the ones on the left. For each animal, you hold the mouse button down to drag it and release the button to "drop" it. If you drop it in the wrong place, it just goes back to it's start

                 

Here is all the code that you need:

    (this code goes on the cow)
        on mouseDown
            grab me
        end mouseDown

        on mouseUp
            if intersect ( image "cow 1" , image "cow 2") then    
                // if you dropped "cow 1" on to "cow 2", then you got it right
                answer "Good job. You matched the cows"
            else
                // if not correct, move "cow 1" back to the start - to location 200,200
                move the image "cow 1" to 200,200                                          
            end if
        end mouseUp

  (this code goes on the pig)

        on mouseDown
             grab me
        end mouseDown

        on mouseUp
            if intersect ( image "pig 1" , image "pig 2") then
                answer "Good job. You matched the pigs"
            else
                 move the image "pig 1" to 200,300
            end if
        end mouseUp



In this second screen, you have to put the animals on the right with its friends on the left. For each animal, you hold the mouse button down to drag it and release the button to "drop" it. If you drop it in the wrong place, it just goes back to it's start

                   

(this code goes on the card)
on mouseDown
    grab me
end mouseDown

on mouseUp
    if intersect ( image "sheep" , graphic "rectangle 1") then
        answer "Good job."
    else
        move the image "sheep" to 200,100
    end if

    if intersect ( image "chick" , graphic "rectangle 2") then
        answer "Good job."
    else
        move the image "chick" to 200,200
    end if

    if intersect ( image "sheep" , graphic "rectangle 3") then
        answer "Good job."
    else
        move the image "sheep" to 200,300
    end if

end mouseUp

     C. Maze Game 

         You use the cursor (arrow) keys on the keyboard to move the mouse. If you run into a wall of the maze, it goes back to the start. The object is to get to the cheese. The maze is hand drawn with lines which are then "grouped" into a group called "maze"

                                   

(this code goes on the card)
    on arrowKey x


        if x = "right" then                                                                                             
             
//  if you pressed the right arrow key, move the mouse right +1
            set the right of image "mouse" to the right of image "mouse" + 1              
        end if
        if x = "left" then                                                                                         
            //  if you pressed the left arrow key, move the mouse left -1
            set the left of image "mouse" to the left of image "mouse" - 1
        end if
        if x = "up" then
            set the top of image "mouse" to the top of image "mouse" - 1
        end if
        if x = "down" then
            set the bottom of image "mouse" to the bottom of image "mouse" + 1
        end if

       if intersect (image "mouse" , group "maze" )  then
          move the image "mouse" to 74,27 in 1 sec
       end if
       if intersect (image "mouse" , image "cheese" )  then
              answer "Hooray, You Win !!)
       end if

    end arrowKey

  

  D. Action Game ( Frogger)

      You use the cursor (arrow) keys on the keyboard to make the frog move. The object is to get across the highway without being hit by a car

                                    

(this code goes on the card)

    on arrowKey x

        if x = "right" then
            set the right of image "frog" to the right of image "frog" + 1
        end if
        if x = "left" then
            set the left of image "frog" to the left of image "frog" - 1
        end if
        if x = "up" then
            set the top of image "frog" to the top of image "frog" - 1
        end if
        if x = "down" then
            set the bottom of image "frog" to the bottom of image "frog" + 1
        end if

       if intersect (image "frog" , image "car" )  then
                answer "You lose, play again? " with "No" or "Yes"
                if it is "Yes" then 
                        move the image "frog" to 100,50 
               else
                        quit
              endif
       end if

    end arrowKey

The cars move from right to left and when they go off on the left side of the card, the start again on the right side. They move every 10 millisecs and always are moving whether or not the frog is moving

on moveCars
     set the left of image "car" to the left of image "car" - 2
     if the left of image "car" < 0 then
         set the left of image "car" to the right of the card "road"
    end if
    send "moveCars" to me in 10 millisecs
end moveCars



   E. Stock Quote App/Widget

This is an app or widget that check the price of your favorite stocks by clicking on the button

                    


The following code is what is on the Apple (AAPL) button:

on mouseUp
       local x
       //  get the latest quotes from Yahoo finance website 
       put url "http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=nbgh" into x      
       put item 1 of line 1 of x into the field "NameAns"
       put item 2 of line 1 of x into the field "BidAns"
       put item 3 of line 1 of x into the field "HighAns"
       put item 4 of line 1 of x into the field "LowAns"   
end mouseUp

For more examples and code samples go here


    F. Animal Wizard 

Animal Wizard Knows Every Animal on the Planet !!

That is an exaggeration right now, but it does know a lot of them. 

If you tell it the first letter of the animal you are thinking of, it will guess the animal. If it does not guess it, it will add it to its list and know about it the next time you run it.

   It learns from you.   

Check it out here


3. What  Apps and Programs Can You Write, What Has Been Written In LiveCode?

    The following is what we have done in class, and you can also learn to do: 
            Artificial Intelligence  - Create your own Chatbot, Virtual Assistant, Siri © or Google Now ©.  
          Data/BigData  - How popular is your name? How many people in the US have the same name?  
          Cryptography  - Secret Codes,  
          DigitalMagic  - Add people/remove people from photographs, change backgrounds easily with code 
          Facial Recognition  - Recognize faces, tells when you need a haircut  
          Chat Room  - Build your own chat room, web server, mail client, or completely new Internet protocol 

    The following is what other people have done:  (older)

Games - Apps -  Written by students like you, download and play them on your PC/Mac computer, 

Trojan Horses and Malware - see how LiveCode is used in the most recent exploits

1001 Things To Do - See a wide range of programs and games written by other people. You will be amazed at what all can be done with a few lines of code


Apps in LiveCode - (see the apps listed below) 
This is an incomplete listing because most apps do not advertise their base language. These are Apps from the Apple App Store people have written and mentioned on the LiveCode Forums.  This is what I have been able to find...

RunRev - Apps Listed on the LiveCode website - RunRev-Showcase

Customers/Developers
The following are apps that have been written in LiveCode submitted by their authors. This is not meant to be a complete list, just a sampling of them. These were taken from the forums at LiveCode from postings in the thread - List of IOS Apps created with LiveCode Inspiration Thread

Posts:
HexThello - (Paid) Game
Basic Electronics - (Paid) Learning
HexClock - (Free) Utility
Etud - (Free) Business, Turkish
iTunes (free) : NMEA gpsRecorder
Many Educational Apps listed here
BeatSpeak - a talking multilingual metronome
EV-Point - electric vehicle recharge station finder - using browser javascript interaction, Google fusion + maps
My dad and I put out "Flat Out Fitness", a fitness timer for high-intensity interval training, that is sold on the App Store, Amazon Marketplace, and Google Play. - App Store - Google Play - Amazon Marketplace 
EndyR14 - Puzzle?
Educational App - for conflict resolution
SmoothieRx - App to create smoothies
E2 Flat Rate - for Electrical Contractors



Comments